@Test public void testISOUtilCompatibility() throws Exception { byte[] b=ISOUtil.hex2byte("66656637656236643736323431653438"); AsciiHexInterpreter as=AsciiHexInterpreter.INSTANCE; byte[] n=as.uninterpret(b, 0, 8); byte[] a=ISOUtil.hex2byte("46454637454236443736323431453438"); byte[] n1=as.uninterpret(a, 0, 8); byte[] expected = ISOUtil.hex2byte("fef7eb6d76241e48"); assertEquals (ISOUtil.hexString(expected), ISOUtil.hexString(n)); assertEquals (ISOUtil.hexString(expected), ISOUtil.hexString(n1)); }
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; }