/**
      * Writes the value read from the provided byte {@code buffer} at the specified {@code index} to
      * the provided {@code objectOutput}.
      *
      * @param objectOutput  the object output stream to which the value is written
      * @param wordSize  the number of bytes used to store the value
      * @param inputBuffer  the byte buffer from which the value is read
      * @param index  the index of the value in the the byte buffer
      * @throws IOException if an error occurred writing to the provided object output stream
      */
   private static void writeExternalWord(ObjectOutput objectOutput, int wordSize,
 ByteBuffer inputBuffer, int index)
   {
       int wordIndex = index * wordSize;
       if (wordSize == SHORT_NUM_BYTES) {
         objectOutput.writeShort(inputBuffer.getShort(wordIndex));
       } else {
         objectOutput.writeInt(inputBuffer.getInt(wordIndex));
       }
   }
 /**
    * Reads the {@code value} at the specified {@code index} from the provided byte {@code buffer}.
    * Note that only integer and short sizes are supported.
    *
    * @param buffer  the byte buffer from which the value is read
    * @param wordSize  the number of bytes used to store the value
    * @param index  the index where the value is read from
    *
    * @return  the value read from the buffer
    */
 private static int readWordFromBuffer(ByteBuffer buffer, int wordSize, int index)
 {
     int wordIndex = index * wordSize;
     return wordSize == SHORT_NUM_BYTES ? buffer.getShort(wordIndex) : buffer.getInt(wordIndex);
 }