I’m trying to use Kryo to read/write objects to disk: http://code.google.com/p/kryo/
Couple questions:
-
How do I determine the size of my byte buffer? If I make it too small it crashes, too large it eats up lots of memory and the files are huge. Follow up, shouldn’t kyro already know how big the object is since it’s the one serializing it?
-
What is a good way to convert them from a ByteBuffer to byte array and back?
-
Anyone have a effective and quick way of reading/writing objects to file using Kyro? My yucky xml is about 100 times faster (which includes parsing, not just i/o) which doesn’t make sense according to the benchmarks. I tried using ByteBuffer writing to FileChannel.
You actually don’t need to muck with
ByteBufferat all, you can use thecom.esotericsoftware.kryo.ObjectBufferPretend you have a class
MyObjectthat you want to serialize;