@Test public void testUninterpret() throws Exception { byte[] data = new byte[] {(byte)0xFF, (byte)0x12}; byte[] b = new byte[] {0x46, 0x46, 0x31, 0x32}; TestUtils.assertEquals(data, inter.uninterpret(b, 0, 2)); }
public byte[] uninterpret(byte[] rawData, int offset, int length) { byte[] d = new byte[length]; for (int i=0; i<length*2; i++) { int shift = i%2 == 1 ? 0 : 4; d[i>>1] |= Character.digit((char) rawData[offset+i], 16) << shift; } return d; }
AsciiHexInterpreter implements BinaryInterpreter { public byte[] uninterpret(byte[] rawData, int offset, int length) { byte[] d = new byte[length]; for (int i=0; i<length*2; i++) { int shift = i%2 == 1 ? 0 : 4; d[i>>1] |= Character.digit((char) rawData[offset+i], 16) << shift; } return d; } }
AsciiHexInterpreter implements BinaryInterpreter { public byte[] uninterpret(byte[] rawData, int offset, int length) { byte[] d = new byte[length]; for (int i=0; i<length*2; i++) { int shift = i%2 == 1 ? 0 : 4; d[i>>1] |= Character.digit((char) rawData[offset+i], 16) << shift; } return d; }  }
AsciiHexInterpreter implements BinaryInterpreter { public byte[] uninterpret(byte[] rawData, int offset, int length) { byte[] d = new byte[length]; for (int i=0; i<length*2; i++) { int shift = i%2 == 1 ? 0 : 4; d[i>>1] |= Character.digit((char) rawData[offset+i], 16) << shift; } return d; }  void interpret(byte[] data, byte[] b, int offset); byte[] uninterpret(byte[] rawData, int offset, int length); int getPackedLength(int nBytes); }
AsciiHexInterpreter implements BinaryInterpreter { public byte[] uninterpret(byte[] rawData, int offset, int length) { byte[] d = new byte[length]; for (int i=0; i<length*2; i++) { int shift = i%2 == 1 ? 0 : 4; d[i>>1] |= Character.digit((char) rawData[offset+i], 16) << shift; } return d; }  void interpret(byte[] data, byte[] b, int offset); byte[] uninterpret(byte[] rawData, int offset, int length); int getPackedLength(int nBytes); static final AsciiHexInterpreter INSTANCE; }