directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Linda Lee <>
Subject Re: [bdbje] [rms] Using int verses Integer and native key/value ordering
Date Fri, 16 Apr 2004 21:17:11 GMT

Alex Karasulu wrote:

>It's me again got a couple more questions:
>1). I peeked at the way an Integer is serialized in the TupleBinding 
>class.  It appears as though the native sorting order of integer keys 
>and values will be the natural integer order.  Just double checking
>so I don't need to write a comparator for an Integer key or value right?
That's right -- no comparators are needed. From

    /Tuples are useful as keys because they have a meaningful sort
    order, while serialized objects do not. This is because the binary
    data for a tuple is written in such a way that its raw byte ordering
    provides a useful sort order. For example, strings in tuples are
    written with a null terminator rather than with a leading length./

>2). Also is there a way to not have to wrap primitive types using the
>binding API's - basically is there some means to just setData on an entry
>but get the binding to produce a byte[] from a int and not an Integer
Mark is the expert here, but you can use the tuple classes to create 
your own custom binding. Or you could use 
com.sleepycat.bind.tuple.TupleInput, TupleOutput  to read and write 
primitive types to a byte buffer. See

The general notion is that you create a TupleBinding, using the 
TupleInput/Output to get you from your object to the byte array, but you 
could also use them independently.  The Getting Started Guide has some 


Sleepycat Software

View raw message