From directory-dev-return-1101-apmail-incubator-directory-dev-archive=incubator.apache.org@incubator.apache.org Fri Apr 16 21:17:47 2004 Return-Path: Delivered-To: apmail-incubator-directory-dev-archive@www.apache.org Received: (qmail 31055 invoked from network); 16 Apr 2004 21:17:47 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 16 Apr 2004 21:17:47 -0000 Received: (qmail 95839 invoked by uid 500); 16 Apr 2004 21:17:34 -0000 Delivered-To: apmail-incubator-directory-dev-archive@incubator.apache.org Received: (qmail 95787 invoked by uid 500); 16 Apr 2004 21:17:33 -0000 Mailing-List: contact directory-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Apache Directory Developers List" Reply-To: "Apache Directory Developers List" Delivered-To: mailing list directory-dev@incubator.apache.org Received: (qmail 95764 invoked from network); 16 Apr 2004 21:17:33 -0000 Received: from unknown (HELO mail.sleepycat.com) (209.235.192.68) by daedalus.apache.org with SMTP; 16 Apr 2004 21:17:33 -0000 Received: (qmail 76167 invoked by uid 89); 16 Apr 2004 21:17:39 -0000 Received: from dsl092-066-227.bos1.dsl.speakeasy.net (HELO sleepycat.com) (linda@sleepycat.com@66.92.66.227) by sleepycat1.inetu.net with SMTP; 16 Apr 2004 21:17:39 -0000 Message-ID: <40804D57.6010800@sleepycat.com> Date: Fri, 16 Apr 2004 17:17:11 -0400 From: Linda Lee User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alex Karasulu CC: bdbje@sleepycat.com, 'Apache Directory Developers List' Subject: Re: [bdbje] [rms] Using int verses Integer and native key/value ordering References: <20040416163301.ZMCO1789.imf17aec.mail.bellsouth.net@franklin> In-Reply-To: <20040416163301.ZMCO1789.imf17aec.mail.bellsouth.net@franklin> Content-Type: multipart/alternative; boundary="------------090407030409020706070400" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. --------------090407030409020706070400 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Alex Karasulu wrote: >Hi, > >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 http://www.sleepycat.com/docs/ref/bdb_tuple/intro.html: /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 http://www.sleepycat.com/jedocs/java/index.html. 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 examples: http://www.sleepycat.com/jedocs/GettingStartedGuide/bindAPI.html#customTuple Regards, Linda Sleepycat Software --------------090407030409020706070400 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit

Alex Karasulu wrote:
Hi,

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 http://www.sleepycat.com/docs/ref/bdb_tuple/intro.html:
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 http://www.sleepycat.com/jedocs/java/index.html.

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 examples: http://www.sleepycat.com/jedocs/GettingStartedGuide/bindAPI.html#customTuple


Regards,

Linda
Sleepycat Software
--------------090407030409020706070400--