@Test void bytesToPath() { Bytes path = CompactEncoding.bytesToPath(Bytes.of(0xab, 0xcd, 0xff)); assertEquals(Bytes.of(0xa, 0xb, 0xc, 0xd, 0xf, 0xf, 0x10), path); }
public static Bytes bytesToPath(Bytes bytes) { MutableBytes path = MutableBytes.create(bytes.size() * 2 + 1); int j = 0; for (int i = 0; i < bytes.size(); i += 1, j += 2) { byte b = bytes.get(i); path.set(j, (byte) ((b >>> 4) & 0x0f)); path.set(j + 1, (byte) (b & 0x0f)); } path.set(j, LEAF_TERMINATOR); return path; }
CompactEncoding { public static Bytes bytesToPath(Bytes bytes) { MutableBytes path = MutableBytes.create(bytes.size() * 2 + 1); int j = 0; for (int i = 0; i < bytes.size(); i += 1, j += 2) { byte b = bytes.get(i); path.set(j, (byte) ((b >>> 4) & 0x0f)); path.set(j + 1, (byte) (b & 0x0f)); } path.set(j, LEAF_TERMINATOR); return path; } }
CompactEncoding { public static Bytes bytesToPath(Bytes bytes) { MutableBytes path = MutableBytes.create(bytes.size() * 2 + 1); int j = 0; for (int i = 0; i < bytes.size(); i += 1, j += 2) { byte b = bytes.get(i); path.set(j, (byte) ((b >>> 4) & 0x0f)); path.set(j + 1, (byte) (b & 0x0f)); } path.set(j, LEAF_TERMINATOR); return path; } private  CompactEncoding(); }
CompactEncoding { public static Bytes bytesToPath(Bytes bytes) { MutableBytes path = MutableBytes.create(bytes.size() * 2 + 1); int j = 0; for (int i = 0; i < bytes.size(); i += 1, j += 2) { byte b = bytes.get(i); path.set(j, (byte) ((b >>> 4) & 0x0f)); path.set(j + 1, (byte) (b & 0x0f)); } path.set(j, LEAF_TERMINATOR); return path; } private  CompactEncoding(); static Bytes bytesToPath(Bytes bytes); static Bytes encode(Bytes path); static Bytes decode(Bytes encoded); }
CompactEncoding { public static Bytes bytesToPath(Bytes bytes) { MutableBytes path = MutableBytes.create(bytes.size() * 2 + 1); int j = 0; for (int i = 0; i < bytes.size(); i += 1, j += 2) { byte b = bytes.get(i); path.set(j, (byte) ((b >>> 4) & 0x0f)); path.set(j + 1, (byte) (b & 0x0f)); } path.set(j, LEAF_TERMINATOR); return path; } private  CompactEncoding(); static Bytes bytesToPath(Bytes bytes); static Bytes encode(Bytes path); static Bytes decode(Bytes encoded); static final byte LEAF_TERMINATOR; }