@Test public void testDecode19() throws Exception { byte[] b = new byte[]{0x19}; assertEquals(19, BcdPrefixer.LL.decodeLength(b, 0)); }
@Override public int decodeLength(byte[] b, int offset) { int len = 0; for (int i = 0; i < (nDigits + 1) / 2; i++) { len = 100 * len + ((b[offset + i] & 0xF0) >> 4) * 10 + (b[offset + i] & 0x0F); } return len; }
BcdPrefixer implements Prefixer { @Override public int decodeLength(byte[] b, int offset) { int len = 0; for (int i = 0; i < (nDigits + 1) / 2; i++) { len = 100 * len + ((b[offset + i] & 0xF0) >> 4) * 10 + (b[offset + i] & 0x0F); } return len; } }
BcdPrefixer implements Prefixer { @Override public int decodeLength(byte[] b, int offset) { int len = 0; for (int i = 0; i < (nDigits + 1) / 2; i++) { len = 100 * len + ((b[offset + i] & 0xF0) >> 4) * 10 + (b[offset + i] & 0x0F); } return len; } BcdPrefixer(int nDigits); }
BcdPrefixer implements Prefixer { @Override public int decodeLength(byte[] b, int offset) { int len = 0; for (int i = 0; i < (nDigits + 1) / 2; i++) { len = 100 * len + ((b[offset + i] & 0xF0) >> 4) * 10 + (b[offset + i] & 0x0F); } return len; } BcdPrefixer(int nDigits); @Override void encodeLength(int length, byte[] b); @Override int decodeLength(byte[] b, int offset); @Override int getPackedLength(); }
BcdPrefixer implements Prefixer { @Override public int decodeLength(byte[] b, int offset) { int len = 0; for (int i = 0; i < (nDigits + 1) / 2; i++) { len = 100 * len + ((b[offset + i] & 0xF0) >> 4) * 10 + (b[offset + i] & 0x0F); } return len; } BcdPrefixer(int nDigits); @Override void encodeLength(int length, byte[] b); @Override int decodeLength(byte[] b, int offset); @Override int getPackedLength(); static final BcdPrefixer L; static final BcdPrefixer LL; static final BcdPrefixer LLL; static final BcdPrefixer LLLL; static final BcdPrefixer LLLLL; }