@Test public void testReadWString() throws IOException { String value = "Hello world"; BinaryReader binaryReader = testBinaryReaderBuilder.putWString(value).build(); assertEquals(value, binaryReader.readWString(value.length())); assertEquals(value.length() * 2, binaryReader.getPosition()); }
public String readWString(int length) { int numBytes = length * 2; String result = Charsets.UTF_16LE.decode(ByteBuffer.wrap(bytes, position, numBytes)).toString(); position += numBytes; return result; }
BinaryReader { public String readWString(int length) { int numBytes = length * 2; String result = Charsets.UTF_16LE.decode(ByteBuffer.wrap(bytes, position, numBytes)).toString(); position += numBytes; return result; } }
BinaryReader { public String readWString(int length) { int numBytes = length * 2; String result = Charsets.UTF_16LE.decode(ByteBuffer.wrap(bytes, position, numBytes)).toString(); position += numBytes; return result; } BinaryReader(BinaryReader binaryReader, int position);  BinaryReader(InputStream inputStream, int size);  BinaryReader(byte[] bytes); }
BinaryReader { public String readWString(int length) { int numBytes = length * 2; String result = Charsets.UTF_16LE.decode(ByteBuffer.wrap(bytes, position, numBytes)).toString(); position += numBytes; return result; } BinaryReader(BinaryReader binaryReader, int position);  BinaryReader(InputStream inputStream, int size);  BinaryReader(byte[] bytes); int read(); int peek(); byte[] peekBytes(int length); byte[] readBytes(int length); void readBytes(byte[] buf, int offset, int length); String readGuid(); String readString(int length); String readWString(int length); UnsignedLong readQWord(); UnsignedInteger readDWord(); UnsignedInteger readDWordBE(); int readWord(); int readWordBE(); Date readFileTime(); String readAndBase64EncodeBinary(int length); void skip(int bytes); int getPosition(); byte[] getBytes(); }
BinaryReader { public String readWString(int length) { int numBytes = length * 2; String result = Charsets.UTF_16LE.decode(ByteBuffer.wrap(bytes, position, numBytes)).toString(); position += numBytes; return result; } BinaryReader(BinaryReader binaryReader, int position);  BinaryReader(InputStream inputStream, int size);  BinaryReader(byte[] bytes); int read(); int peek(); byte[] peekBytes(int length); byte[] readBytes(int length); void readBytes(byte[] buf, int offset, int length); String readGuid(); String readString(int length); String readWString(int length); UnsignedLong readQWord(); UnsignedInteger readDWord(); UnsignedInteger readDWordBE(); int readWord(); int readWordBE(); Date readFileTime(); String readAndBase64EncodeBinary(int length); void skip(int bytes); int getPosition(); byte[] getBytes(); static final long EPOCH_OFFSET; static final int[][] INDEX_ARRAYS; }