Esempio n. 1
0
        /**
         * Stores a value which is read from the provided {@code objectInput} to the provided byte {@code
         * buffer} at the specified {@code index}.
         *
         * @param objectInput  the object input stream from which the value is read
         * @param wordSize  the number of bytes used to store the value read from the stream
         * @param outputBuffer  the byte buffer to which the value is stored
         * @param index  the index where the value is stored in the buffer
         * @throws IOException  if an error occurred reading from the object input stream
         */
        private static void readExternalWord(ObjectInput objectInput, int wordSize,
                                             ByteBuffer outputBuffer, int index)
        {
            int wordIndex = index * wordSize;

            if (wordSize == SHORT_NUM_BYTES)
            {
                outputBuffer.putShort(wordIndex, objectInput.readShort());
            }
            else
            {
                outputBuffer.putInt(wordIndex, objectInput.readInt());
            }
        }
Esempio n. 2
0
 public short readShort()
 {
     return(_javaObjectInput.readShort());
 }
   /**
      * Stores a value which is read from the provided {@code objectInput} to the provided byte {@code
      * buffer} at the specified {@code index}.
      *
      * @param objectInput  the object input stream from which the value is read
      * @param wordSize  the number of bytes used to store the value read from the stream
      * @param outputBuffer  the byte buffer to which the value is stored
      * @param index  the index where the value is stored in the buffer
      * @throws IOException  if an error occurred reading from the object input stream
      */
   private static void readExternalWord(ObjectInput objectInput, int wordSize,
 ByteBuffer outputBuffer, int index)
   {
       int wordIndex = index * wordSize;
       if (wordSize == SHORT_NUM_BYTES) {
         outputBuffer.putShort(wordIndex, objectInput.readShort());
       } else {
         outputBuffer.putInt(wordIndex, objectInput.readInt());
       }
   }