static void marshal(Object obj) throws Exception { byte[] buf = Util.objectToByteBuffer(obj); assert buf != null; assert buf.length > 0; Object obj2 = Util.objectFromByteBuffer(buf); System.out.println( "obj=" + obj + ", obj2=" + obj2 + " (type=" + obj.getClass().getName() + ", length=" + buf.length + " bytes)"); Assert.assertEquals(obj, obj2); if (obj instanceof Integer) { // test compressed ints and longs buf = new byte[10]; Bits.writeIntCompressed((int) obj, buf, 0); obj2 = Bits.readIntCompressed(buf, 0); assert obj.equals(obj2); } if (obj instanceof Long) { // test compressed ints and longs buf = new byte[10]; Bits.writeLongCompressed((long) obj, buf, 0); obj2 = Bits.readLongCompressed(buf, 0); assert obj.equals(obj2); } }