Deserializer { public short readShort() { _detectBufferUnderflow(2); short s = BigEndianCodec.getShort(_buffer, _index); _index += 2; return s; } Deserializer(ByteBuffer byteBuffer); boolean readBoolean(); byte readByte(); char readChar(); double readDouble(); float readFloat(); int readInt(); long readLong(); T readObject(); short readShort(); String readString();  }
@Test public void testReadShort() { ByteBuffer byteBuffer = ByteBuffer.allocate(_COUNT * 2); byteBuffer.order(ByteOrder.BIG_ENDIAN); ShortBuffer shortBuffer = byteBuffer.asShortBuffer(); short[] shorts = new short[_COUNT]; for (int i = 0; i < _COUNT; i++) { shorts[i] = (short)_random.nextInt(); shortBuffer.put(shorts[i]); } Deserializer deserializer = new Deserializer(byteBuffer); for (int i = 0; i < _COUNT; i++) { Assert.assertEquals(shorts[i], deserializer.readShort()); } }