Deserializer { public char readChar() { _detectBufferUnderflow(2); char c = BigEndianCodec.getChar(_buffer, _index); _index += 2; return c; } 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 testReadChar() { ByteBuffer byteBuffer = ByteBuffer.allocate(_COUNT * 2); byteBuffer.order(ByteOrder.BIG_ENDIAN); CharBuffer charBuffer = byteBuffer.asCharBuffer(); char[] chars = new char[_COUNT]; for (int i = 0; i < _COUNT; i++) { chars[i] = (char)_random.nextInt(); charBuffer.put(chars[i]); } Deserializer deserializer = new Deserializer(byteBuffer); for (int i = 0; i < _COUNT; i++) { Assert.assertEquals(chars[i], deserializer.readChar()); } }