I recall seeing somewhere that JDBM had a binary interface, but looking=20
at the code (the June snapshot) it uses Object for all commands. It=20
would be really really nice to have a binary interface. Has this never=20
existed, or is it on TODO list, or..?
Got blog? I do. http://dreambean.com
From: Alex Boisvert <boisvert@in...> - 2003-07-31 15:41:31
There are two ways to insert objects in JDBM with the RecordManager:
1) RecordManager.insert( Object obj )
2) RecordManager.insert( Object obj, Serializer serializer )
The first one is a convenience method that automatically serializes your=20
object. The second one can accept any kind of object, including binary=20
data (byte arrays, streams, ...) and uses a Serializer do figure out how=20
to convert your object into a format suitable for persistence.
So, out of the box, the easiest way to put binary data is to use the=20
ByteArraySerializer, like this:
// fill-in your buffer
buffer =3D new byte;
long id =3D recman.insert( buffer, ByteArraySerializer.INSTANCE );
This will directly persist your byte array without any kind of=20
serialization overhead. Straight bytes.
Rickard =C3=96berg wrote:
> I recall seeing somewhere that JDBM had a binary interface, but=20
> looking at the code (the June snapshot) it uses Object for all=20
> commands. It would be really really nice to have a binary interface.=20
> Has this never existed, or is it on TODO list, or..?