@Test public void testReadGuid() throws IOException { String guid = "33323130-3534-3736-3839-616263646566"; BinaryReader binaryReader = testBinaryReaderBuilder.putGuid(guid).build(); assertEquals(guid, binaryReader.readGuid()); assertEquals(16, binaryReader.getPosition()); }
public String readGuid() { StringBuilder result = new StringBuilder(); int maxIndex = 0; for (int[] indexArray : INDEX_ARRAYS) { for (int index : indexArray) { maxIndex = Math.max(maxIndex, index); result.append(String.format("%02X", bytes[position + index]).toLowerCase()); } result.append("-"); } result.setLength(result.length() - 1); position += (maxIndex + 1); return result.toString(); }
BinaryReader { public String readGuid() { StringBuilder result = new StringBuilder(); int maxIndex = 0; for (int[] indexArray : INDEX_ARRAYS) { for (int index : indexArray) { maxIndex = Math.max(maxIndex, index); result.append(String.format("%02X", bytes[position + index]).toLowerCase()); } result.append("-"); } result.setLength(result.length() - 1); position += (maxIndex + 1); return result.toString(); } }
BinaryReader { public String readGuid() { StringBuilder result = new StringBuilder(); int maxIndex = 0; for (int[] indexArray : INDEX_ARRAYS) { for (int index : indexArray) { maxIndex = Math.max(maxIndex, index); result.append(String.format("%02X", bytes[position + index]).toLowerCase()); } result.append("-"); } result.setLength(result.length() - 1); position += (maxIndex + 1); return result.toString(); } BinaryReader(BinaryReader binaryReader, int position);  BinaryReader(InputStream inputStream, int size);  BinaryReader(byte[] bytes); }
BinaryReader { public String readGuid() { StringBuilder result = new StringBuilder(); int maxIndex = 0; for (int[] indexArray : INDEX_ARRAYS) { for (int index : indexArray) { maxIndex = Math.max(maxIndex, index); result.append(String.format("%02X", bytes[position + index]).toLowerCase()); } result.append("-"); } result.setLength(result.length() - 1); position += (maxIndex + 1); return result.toString(); } 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 readGuid() { StringBuilder result = new StringBuilder(); int maxIndex = 0; for (int[] indexArray : INDEX_ARRAYS) { for (int index : indexArray) { maxIndex = Math.max(maxIndex, index); result.append(String.format("%02X", bytes[position + index]).toLowerCase()); } result.append("-"); } result.setLength(result.length() - 1); position += (maxIndex + 1); return result.toString(); } 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; }