DataTypeUtil { static void pathToBuffer(Path p, WriteBuffer buffer) { int len = p.getDepth() + (p.isAbsolute() ? 1 : 0); buffer.putVarInt(len); while (p != null) { StringDataType.INSTANCE.write(buffer, p.getName()); p = p.getParent(); } }    }
@Test public void pathToBuffer() { Path p = Path.fromString("/foo/bar/quux"); DataTypeUtil.pathToBuffer(p, wb); ByteBuffer rb = readBufferFrom(wb); assertEquals(p, DataTypeUtil.pathFromBuffer(rb)); }