| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
|
| 3 |
<HTML> |
| 4 |
<HEAD> |
| 5 |
|
| 6 |
<TITLE> |
| 7 |
com.sleepycat.bind.tuple (Oracle - Berkeley DB Java API) |
| 8 |
</TITLE> |
| 9 |
|
| 10 |
<META NAME="date" CONTENT="2013-09-09"> |
| 11 |
|
| 12 |
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../style.css" TITLE="Style"> |
| 13 |
|
| 14 |
<SCRIPT type="text/javascript"> |
| 15 |
function windowTitle() |
| 16 |
{ |
| 17 |
if (location.href.indexOf('is-external=true') == -1) { |
| 18 |
parent.document.title="com.sleepycat.bind.tuple (Oracle - Berkeley DB Java API)"; |
| 19 |
} |
| 20 |
} |
| 21 |
</SCRIPT> |
| 22 |
<NOSCRIPT> |
| 23 |
</NOSCRIPT> |
| 24 |
|
| 25 |
</HEAD> |
| 26 |
|
| 27 |
<BODY BGCOLOR="white" onload="windowTitle();"> |
| 28 |
<HR> |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
<A NAME="navbar_top"></A> |
| 33 |
<A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
| 34 |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| 35 |
<TR> |
| 36 |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| 37 |
<A NAME="navbar_top_firstrow"></A> |
| 38 |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| 39 |
<TR ALIGN="center" VALIGN="top"> |
| 40 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| 41 |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD> |
| 42 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD> |
| 43 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| 44 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| 45 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| 46 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| 47 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| 48 |
</TR> |
| 49 |
</TABLE> |
| 50 |
</TD> |
| 51 |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| 52 |
<b>Berkeley DB</b><br><font size="-1"> version 5.3.28</font></EM> |
| 53 |
</TD> |
| 54 |
</TR> |
| 55 |
|
| 56 |
<TR> |
| 57 |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| 58 |
<A HREF="../../../../com/sleepycat/bind/serial/package-summary.html"><B>PREV PACKAGE</B></A> |
| 59 |
<A HREF="../../../../com/sleepycat/collections/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD> |
| 60 |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| 61 |
<A HREF="../../../../index.html?com/sleepycat/bind/tuple/package-summary.html" target="_top"><B>FRAMES</B></A> |
| 62 |
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> |
| 63 |
<SCRIPT type="text/javascript"> |
| 64 |
<!-- |
| 65 |
if(window==top) { |
| 66 |
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| 67 |
} |
| 68 |
//--> |
| 69 |
</SCRIPT> |
| 70 |
<NOSCRIPT> |
| 71 |
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
| 72 |
</NOSCRIPT> |
| 73 |
|
| 74 |
|
| 75 |
</FONT></TD> |
| 76 |
</TR> |
| 77 |
</TABLE> |
| 78 |
<A NAME="skip-navbar_top"></A> |
| 79 |
|
| 80 |
|
| 81 |
<HR> |
| 82 |
<H2> |
| 83 |
Package com.sleepycat.bind.tuple |
| 84 |
</H2> |
| 85 |
Bindings that use sequences of primitive fields, or tuples. |
| 86 |
<P> |
| 87 |
<B>See:</B> |
| 88 |
<BR> |
| 89 |
<A HREF="#package_description"><B>Description</B></A> |
| 90 |
<P> |
| 91 |
|
| 92 |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| 93 |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| 94 |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| 95 |
<B>Interface Summary</B></FONT></TH> |
| 96 |
</TR> |
| 97 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 98 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/MarshalledTupleEntry.html" title="interface in com.sleepycat.bind.tuple">MarshalledTupleEntry</A></B></TD> |
| 99 |
<TD>A marshalling interface implemented by key, data or entity classes that |
| 100 |
are represented as tuples.</TD> |
| 101 |
</TR> |
| 102 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 103 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/MarshalledTupleKeyEntity.html" title="interface in com.sleepycat.bind.tuple">MarshalledTupleKeyEntity</A></B></TD> |
| 104 |
<TD>A marshalling interface implemented by entity classes that represent keys as |
| 105 |
tuples.</TD> |
| 106 |
</TR> |
| 107 |
</TABLE> |
| 108 |
|
| 109 |
|
| 110 |
<P> |
| 111 |
|
| 112 |
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> |
| 113 |
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> |
| 114 |
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> |
| 115 |
<B>Class Summary</B></FONT></TH> |
| 116 |
</TR> |
| 117 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 118 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/BigDecimalBinding.html" title="class in com.sleepycat.bind.tuple">BigDecimalBinding</A></B></TD> |
| 119 |
<TD>A concrete <code>TupleBinding</code> for an unsorted <code>BigDecimal</code> |
| 120 |
value.</TD> |
| 121 |
</TR> |
| 122 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 123 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/BigIntegerBinding.html" title="class in com.sleepycat.bind.tuple">BigIntegerBinding</A></B></TD> |
| 124 |
<TD>A concrete <code>TupleBinding</code> for a <code>BigInteger</code> value.</TD> |
| 125 |
</TR> |
| 126 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 127 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/BooleanBinding.html" title="class in com.sleepycat.bind.tuple">BooleanBinding</A></B></TD> |
| 128 |
<TD>A concrete <code>TupleBinding</code> for a <code>Boolean</code> primitive |
| 129 |
wrapper or a <code>boolean</code> primitive.</TD> |
| 130 |
</TR> |
| 131 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 132 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/ByteBinding.html" title="class in com.sleepycat.bind.tuple">ByteBinding</A></B></TD> |
| 133 |
<TD>A concrete <code>TupleBinding</code> for a <code>Byte</code> primitive |
| 134 |
wrapper or a <code>byte</code> primitive.</TD> |
| 135 |
</TR> |
| 136 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 137 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/CharacterBinding.html" title="class in com.sleepycat.bind.tuple">CharacterBinding</A></B></TD> |
| 138 |
<TD>A concrete <code>TupleBinding</code> for a <code>Character</code> primitive |
| 139 |
wrapper or a <code>char</code> primitive.</TD> |
| 140 |
</TR> |
| 141 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 142 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/DoubleBinding.html" title="class in com.sleepycat.bind.tuple">DoubleBinding</A></B></TD> |
| 143 |
<TD>A concrete <code>TupleBinding</code> for an unsorted <code>Double</code> |
| 144 |
primitive wrapper or an unsorted <code>double</code> primitive.</TD> |
| 145 |
</TR> |
| 146 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 147 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/FloatBinding.html" title="class in com.sleepycat.bind.tuple">FloatBinding</A></B></TD> |
| 148 |
<TD>A concrete <code>TupleBinding</code> for an unsorted <code>Float</code> |
| 149 |
primitive wrapper or an unsorted <code>float</code> primitive.</TD> |
| 150 |
</TR> |
| 151 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 152 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/IntegerBinding.html" title="class in com.sleepycat.bind.tuple">IntegerBinding</A></B></TD> |
| 153 |
<TD>A concrete <code>TupleBinding</code> for a <code>Integer</code> primitive |
| 154 |
wrapper or an <code>int</code> primitive.</TD> |
| 155 |
</TR> |
| 156 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 157 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/LongBinding.html" title="class in com.sleepycat.bind.tuple">LongBinding</A></B></TD> |
| 158 |
<TD>A concrete <code>TupleBinding</code> for a <code>Long</code> primitive |
| 159 |
wrapper or a <code>long</code> primitive.</TD> |
| 160 |
</TR> |
| 161 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 162 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/PackedIntegerBinding.html" title="class in com.sleepycat.bind.tuple">PackedIntegerBinding</A></B></TD> |
| 163 |
<TD>A concrete <code>TupleBinding</code> for an unsorted <code>Integer</code> |
| 164 |
primitive wrapper or an unsorted <code>int</code> primitive, that stores the |
| 165 |
value in the smallest number of bytes possible.</TD> |
| 166 |
</TR> |
| 167 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 168 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/PackedLongBinding.html" title="class in com.sleepycat.bind.tuple">PackedLongBinding</A></B></TD> |
| 169 |
<TD>A concrete <code>TupleBinding</code> for an unsorted <code>Long</code> |
| 170 |
primitive wrapper or an unsorted <code>long</code> primitive, that stores |
| 171 |
the value in the smallest number of bytes possible.</TD> |
| 172 |
</TR> |
| 173 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 174 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/ShortBinding.html" title="class in com.sleepycat.bind.tuple">ShortBinding</A></B></TD> |
| 175 |
<TD>A concrete <code>TupleBinding</code> for a <code>Short</code> primitive |
| 176 |
wrapper or a <code>short</code> primitive.</TD> |
| 177 |
</TR> |
| 178 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 179 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/SortedBigDecimalBinding.html" title="class in com.sleepycat.bind.tuple">SortedBigDecimalBinding</A></B></TD> |
| 180 |
<TD>A concrete <code>TupleBinding</code> for a sorted <code>BigDecimal</code> |
| 181 |
value.</TD> |
| 182 |
</TR> |
| 183 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 184 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/SortedDoubleBinding.html" title="class in com.sleepycat.bind.tuple">SortedDoubleBinding</A></B></TD> |
| 185 |
<TD>A concrete <code>TupleBinding</code> for a sorted <code>Double</code> |
| 186 |
primitive wrapper or a sorted <code>double</code> primitive.</TD> |
| 187 |
</TR> |
| 188 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 189 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/SortedFloatBinding.html" title="class in com.sleepycat.bind.tuple">SortedFloatBinding</A></B></TD> |
| 190 |
<TD>A concrete <code>TupleBinding</code> for a sorted <code>Float</code> |
| 191 |
primitive wrapper or sorted a <code>float</code> primitive.</TD> |
| 192 |
</TR> |
| 193 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 194 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/SortedPackedIntegerBinding.html" title="class in com.sleepycat.bind.tuple">SortedPackedIntegerBinding</A></B></TD> |
| 195 |
<TD>A concrete <code>TupleBinding</code> for a sorted <code>Integer</code> |
| 196 |
primitive wrapper or a sorted <code>int</code> primitive, that stores the |
| 197 |
value in the smallest number of bytes possible.</TD> |
| 198 |
</TR> |
| 199 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 200 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/SortedPackedLongBinding.html" title="class in com.sleepycat.bind.tuple">SortedPackedLongBinding</A></B></TD> |
| 201 |
<TD>A concrete <code>TupleBinding</code> for a sorted <code>Long</code> |
| 202 |
primitive wrapper or a sorted <code>long</code> primitive, that stores the |
| 203 |
value in the smallest number of bytes possible.</TD> |
| 204 |
</TR> |
| 205 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 206 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/StringBinding.html" title="class in com.sleepycat.bind.tuple">StringBinding</A></B></TD> |
| 207 |
<TD>A concrete <code>TupleBinding</code> for a simple <code>String</code> value.</TD> |
| 208 |
</TR> |
| 209 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 210 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleBase.html" title="class in com.sleepycat.bind.tuple">TupleBase<E></A></B></TD> |
| 211 |
<TD>A base class for tuple bindings and tuple key creators that provides control |
| 212 |
over the allocation of the output buffer.</TD> |
| 213 |
</TR> |
| 214 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 215 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleBinding.html" title="class in com.sleepycat.bind.tuple">TupleBinding<E></A></B></TD> |
| 216 |
<TD>An abstract <code>EntryBinding</code> that treats a key or data entry as a |
| 217 |
tuple; it includes predefined bindings for Java primitive types.</TD> |
| 218 |
</TR> |
| 219 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 220 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html" title="class in com.sleepycat.bind.tuple">TupleInput</A></B></TD> |
| 221 |
<TD>An <code>InputStream</code> with <code>DataInput</code>-like methods for |
| 222 |
reading tuple fields.</TD> |
| 223 |
</TR> |
| 224 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 225 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleInputBinding.html" title="class in com.sleepycat.bind.tuple">TupleInputBinding</A></B></TD> |
| 226 |
<TD>A concrete <code>EntryBinding</code> that uses the <code>TupleInput</code> |
| 227 |
object as the key or data object.</TD> |
| 228 |
</TR> |
| 229 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 230 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleMarshalledBinding.html" title="class in com.sleepycat.bind.tuple">TupleMarshalledBinding<E extends MarshalledTupleEntry></A></B></TD> |
| 231 |
<TD>A concrete <code>TupleBinding</code> that delegates to the |
| 232 |
<code>MarshalledTupleEntry</code> interface of the data or key object.</TD> |
| 233 |
</TR> |
| 234 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 235 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html" title="class in com.sleepycat.bind.tuple">TupleOutput</A></B></TD> |
| 236 |
<TD>An <code>OutputStream</code> with <code>DataOutput</code>-like methods for |
| 237 |
writing tuple fields.</TD> |
| 238 |
</TR> |
| 239 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 240 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleTupleBinding.html" title="class in com.sleepycat.bind.tuple">TupleTupleBinding<E></A></B></TD> |
| 241 |
<TD>An abstract <code>EntityBinding</code> that treats an entity's key entry and |
| 242 |
data entry as tuples.</TD> |
| 243 |
</TR> |
| 244 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 245 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleTupleKeyCreator.html" title="class in com.sleepycat.bind.tuple">TupleTupleKeyCreator<E></A></B></TD> |
| 246 |
<TD>An abstract key creator that uses a tuple key and a tuple data entry.</TD> |
| 247 |
</TR> |
| 248 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 249 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleTupleMarshalledBinding.html" title="class in com.sleepycat.bind.tuple">TupleTupleMarshalledBinding<E extends MarshalledTupleEntry & MarshalledTupleKeyEntity></A></B></TD> |
| 250 |
<TD>A concrete <code>TupleTupleBinding</code> that delegates to the |
| 251 |
<code>MarshalledTupleEntry</code> and |
| 252 |
<code>MarshalledTupleKeyEntity</code> interfaces of the entity class.</TD> |
| 253 |
</TR> |
| 254 |
<TR BGCOLOR="white" CLASS="TableRowColor"> |
| 255 |
<TD WIDTH="15%"><B><A HREF="../../../../com/sleepycat/bind/tuple/TupleTupleMarshalledKeyCreator.html" title="class in com.sleepycat.bind.tuple">TupleTupleMarshalledKeyCreator<E extends MarshalledTupleEntry & MarshalledTupleKeyEntity></A></B></TD> |
| 256 |
<TD>A concrete key creator that works in conjunction with a <A HREF="../../../../com/sleepycat/bind/tuple/TupleTupleMarshalledBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>TupleTupleMarshalledBinding</CODE></A>.</TD> |
| 257 |
</TR> |
| 258 |
</TABLE> |
| 259 |
|
| 260 |
|
| 261 |
<P> |
| 262 |
<A NAME="package_description"></A><H2> |
| 263 |
Package com.sleepycat.bind.tuple Description |
| 264 |
</H2> |
| 265 |
|
| 266 |
<P> |
| 267 |
Bindings that use sequences of primitive fields, or tuples. |
| 268 |
|
| 269 |
|
| 270 |
<h2><a name="formats">Tuple Formats</a></h2> |
| 271 |
|
| 272 |
<p>The serialization format for tuple bindings are designed for compactness, |
| 273 |
serialization speed and proper default sorting.</p> |
| 274 |
|
| 275 |
<p>When a format is used for database keys, it is important to use default |
| 276 |
sorting for best performance. Although a custom comparator may be specified |
| 277 |
for a <A HREF="../../../../com/sleepycat/db/DatabaseConfig.html#setBtreeComparator(java.util.Comparator)"><CODE>database</CODE></A> or |
| 278 |
<a |
| 279 |
href="../../../../com/sleepycat/persist/model/KeyField.html#comparable">entity |
| 280 |
index</a>, custom comparators often reduce performance because comparators are |
| 281 |
called very frequently during Btree operations.</p> |
| 282 |
|
| 283 |
<p>For proper default sorting, the byte array of the stored format must be |
| 284 |
designed so that a byte-by-byte unsigned comparison results in the natural sort |
| 285 |
order, as defined by the <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Comparable.html?is-external=true#compareTo(T)" title="class or interface in java.lang"><CODE>Comparable.compareTo(T)</CODE></A> method of the |
| 286 |
data type. For example, the natural sort order for integers is the standard |
| 287 |
mathematical definition, and is implemented by <code>Integer.compareTo</code>, |
| 288 |
<code>Long.compareTo</code>, etc. This is called <em>default natural |
| 289 |
sorting</em>.</p> |
| 290 |
|
| 291 |
<p>Although most tuple formats provide default natural sorting, not all of them |
| 292 |
do. Certain formats do not provide default natural sorting for historical |
| 293 |
reasons (see the discussion of packed integer and float formats below.) Other |
| 294 |
formats sacrifice default natural sorting for other performance factors (see |
| 295 |
the discussion of BigDecimal formats below.)</p> |
| 296 |
|
| 297 |
|
| 298 |
<h3><a name="stringFormats">String Formats</a></h3> |
| 299 |
|
| 300 |
<p>All <code>String</code> formats support default natural sorting.</p> |
| 301 |
|
| 302 |
<p>Strings are stored as a byte array of UTF encoded characters, either where |
| 303 |
the length must be known by the application, or the byte array is |
| 304 |
zero-terminated. The UTF encoding is described below.</p> |
| 305 |
<ul> |
| 306 |
<li>Null strings are UTF encoded as { 0xFF }, which is not allowed in a |
| 307 |
standard UTF encoding. This allows null strings, as distinct from empty or |
| 308 |
zero length strings, to be represented. Using default sorting, null strings |
| 309 |
will be ordered last. |
| 310 |
</li> |
| 311 |
<li>Zero (0x0000) character values are UTF encoded as non-zero values, and |
| 312 |
therefore embedded zeros in the string are supported. The sequence { 0xC0, |
| 313 |
0x80 } is used to encode a zero character. This UTF encoding is the same one |
| 314 |
used by the native Java UTF libraries and is called |
| 315 |
<a href="http://download.oracle.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8">Modified UTF-8</a>. |
| 316 |
However, this encoding of zero does impact the lexicographical ordering, and |
| 317 |
zeros will not be sorted first (the natural order) or last. |
| 318 |
</li> |
| 319 |
<li>For all character values other than zero, the standard UTF encoding is |
| 320 |
used, and the default sorting is the same as the Unicode lexicographical |
| 321 |
character ordering. |
| 322 |
</li> |
| 323 |
</ul> |
| 324 |
|
| 325 |
<p>Binding classes and methods are provided for zero-terminated and |
| 326 |
known-length <code>String</code> values.</p> |
| 327 |
<ul> |
| 328 |
<li>Single-value binding classes for zero-terminated <code>String</code> |
| 329 |
values.</li> |
| 330 |
<ul> |
| 331 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/StringBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>StringBinding</CODE></A></li> |
| 332 |
</ul> |
| 333 |
<li>Multi-value binding methods for zero-terminated and known-length <code>String</code> values.</li> |
| 334 |
<ul> |
| 335 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeString(java.lang.String)"><CODE>TupleOutput.writeString(String)</CODE></A></li> |
| 336 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readString()"><CODE>TupleInput.readString()</CODE></A></li> |
| 337 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#getStringByteLength()"><CODE>TupleInput.getStringByteLength()</CODE></A></li> |
| 338 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeString(char[])"><CODE>TupleOutput.writeString(char[])</CODE></A></li> |
| 339 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readString(char[])"><CODE>TupleInput.readString(char[])</CODE></A></li> |
| 340 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readString(int)"><CODE>TupleInput.readString(int)</CODE></A></li> |
| 341 |
</ul> |
| 342 |
</ul> |
| 343 |
|
| 344 |
<h3><a name="integerFormats">Integer Formats</a></h3> |
| 345 |
|
| 346 |
<h4>Fixed Size Integer Formats</h4> |
| 347 |
|
| 348 |
<p>All fixed size integer formats support default natural sorting.</p> |
| 349 |
|
| 350 |
<p>The size of the stored value depends on the type, and ranges (as one would |
| 351 |
expect) from 1 byte for type <code>byte</code> and class <code>Byte</code>, to 8 bytes for |
| 352 |
type <code>long</code> and class <code>Long</code>.</p> |
| 353 |
|
| 354 |
<p>Signed numbers are stored in the buffer in MSB (most significant byte first) |
| 355 |
order with their sign bit (high-order bit) inverted to cause negative numbers |
| 356 |
to be sorted first when comparing values as unsigned byte arrays, as done in a |
| 357 |
database.</p> |
| 358 |
|
| 359 |
<ul> |
| 360 |
<li>Single-value binding classes for signed, fixed size integers.</li> |
| 361 |
<ul> |
| 362 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/ByteBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>ByteBinding</CODE></A></li> |
| 363 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/ShortBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>ShortBinding</CODE></A></li> |
| 364 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/IntegerBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>IntegerBinding</CODE></A></li> |
| 365 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/LongBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>LongBinding</CODE></A></li> |
| 366 |
</ul> |
| 367 |
<li>Multi-value binding methods for signed, fixed size integers.</li> |
| 368 |
<ul> |
| 369 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeByte(int)"><CODE>TupleOutput.writeByte(int)</CODE></A></li> |
| 370 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readByte()"><CODE>TupleInput.readByte()</CODE></A></li> |
| 371 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeShort(int)"><CODE>TupleOutput.writeShort(int)</CODE></A></li> |
| 372 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readShort()"><CODE>TupleInput.readShort()</CODE></A></li> |
| 373 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeInt(int)"><CODE>TupleOutput.writeInt(int)</CODE></A></li> |
| 374 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readInt()"><CODE>TupleInput.readInt()</CODE></A></li> |
| 375 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeLong(long)"><CODE>TupleOutput.writeLong(long)</CODE></A></li> |
| 376 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readLong()"><CODE>TupleInput.readLong()</CODE></A></li> |
| 377 |
</ul> |
| 378 |
</ul> |
| 379 |
|
| 380 |
<p>Unsigned numbers, including characters, are stored in MSB order with no |
| 381 |
change to their sign bit. Arrays of characters and unsigned bytes may also be |
| 382 |
stored and may be treated as <code>String</code> values. For booleans, <code>true</code> |
| 383 |
is stored as the unsigned byte value one and <code>false</code> as the unsigned byte |
| 384 |
value zero.</p> |
| 385 |
|
| 386 |
<ul> |
| 387 |
<li>Single-value binding classes for characters and booleans.</li> |
| 388 |
<ul> |
| 389 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/BooleanBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>BooleanBinding</CODE></A></li> |
| 390 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/CharacterBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>CharacterBinding</CODE></A></li> |
| 391 |
</ul> |
| 392 |
<li>Multi-value binding methods for unsigned, fixed size integers, characters |
| 393 |
and booleans.</li> |
| 394 |
<ul> |
| 395 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBoolean(boolean)"><CODE>TupleOutput.writeBoolean(boolean)</CODE></A></li> |
| 396 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBoolean()"><CODE>TupleInput.readBoolean()</CODE></A></li> |
| 397 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeChar(int)"><CODE>TupleOutput.writeChar(int)</CODE></A></li> |
| 398 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readChar()"><CODE>TupleInput.readChar()</CODE></A></li> |
| 399 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeUnsignedByte(int)"><CODE>TupleOutput.writeUnsignedByte(int)</CODE></A></li> |
| 400 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readUnsignedByte()"><CODE>TupleInput.readUnsignedByte()</CODE></A></li> |
| 401 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeUnsignedShort(int)"><CODE>TupleOutput.writeUnsignedShort(int)</CODE></A></li> |
| 402 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readUnsignedShort()"><CODE>TupleInput.readUnsignedShort()</CODE></A></li> |
| 403 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeUnsignedInt(long)"><CODE>TupleOutput.writeUnsignedInt(long)</CODE></A></li> |
| 404 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readUnsignedInt()"><CODE>TupleInput.readUnsignedInt()</CODE></A></li> |
| 405 |
</ul> |
| 406 |
<li>Multi-value binding methods for character arrays and unsigned byte arrays |
| 407 |
that may be treated as <code>String</code> values.</li> |
| 408 |
<ul> |
| 409 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeChars(java.lang.String)"><CODE>TupleOutput.writeChars(String)</CODE></A></li> |
| 410 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readChars(int)"><CODE>TupleInput.readChars(int)</CODE></A></li> |
| 411 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeChars(char[])"><CODE>TupleOutput.writeChars(char[])</CODE></A></li> |
| 412 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readChars(char[])"><CODE>TupleInput.readChars(char[])</CODE></A></li> |
| 413 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBytes(java.lang.String)"><CODE>TupleOutput.writeBytes(String)</CODE></A></li> |
| 414 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBytes(int)"><CODE>TupleInput.readBytes(int)</CODE></A></li> |
| 415 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBytes(char[])"><CODE>TupleOutput.writeBytes(char[])</CODE></A></li> |
| 416 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBytes(char[])"><CODE>TupleInput.readBytes(char[])</CODE></A></li> |
| 417 |
</ul> |
| 418 |
</ul> |
| 419 |
|
| 420 |
<h4>Packed Integer Formats</h4> |
| 421 |
|
| 422 |
<p>The packed integer format stores integers with small absolute values in a |
| 423 |
single byte. The size increases as the absolute value increases, up to a |
| 424 |
maximum of 5 bytes for <code>int</code> values and 9 bytes for <code>long</code> |
| 425 |
values.</p> |
| 426 |
|
| 427 |
<p>The packed integer format can be used for integer values between <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Long.html?is-external=true#MIN_VALUE" title="class or interface in java.lang"><CODE>Long.MIN_VALUE</CODE></A> and <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Long.html?is-external=true#MAX_VALUE" title="class or interface in java.lang"><CODE>Long.MAX_VALUE</CODE></A>. However, |
| 428 |
different bindings and methods are provided for type <code>int</code> and <code>long</code>, to avoid unsafe casting from <code>long</code> to <code>int</code> when <code>int</code> values are used.</p> |
| 429 |
|
| 430 |
<p>Because the same packed format is used for <code>int</code> and <code>long</code> |
| 431 |
values, stored <code>int</code> values may be expanded to <code>long</code> values |
| 432 |
without introducing a format incompatibility. In other words, you can treat |
| 433 |
previously stored packed <code>int</code> values as packed <code>long</code> values.</p> |
| 434 |
|
| 435 |
<p>Packed integer formats come in two varieties: those that support default |
| 436 |
natural sorting and those that don't. The formats of the two varieties are |
| 437 |
incompatible. For new applications, the format that supports default natural |
| 438 |
sorting should normally be used. There is no performance advantage to using |
| 439 |
the unsorted format.</p> |
| 440 |
|
| 441 |
<p>The format with support for default natural sorting stores values in the |
| 442 |
inclusive range [-119,120] in a single byte.</p> |
| 443 |
<ul> |
| 444 |
<li>Single-value binding classes for packed integers with default natural |
| 445 |
sorting.</li> |
| 446 |
<ul> |
| 447 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/SortedPackedIntegerBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>SortedPackedIntegerBinding</CODE></A></li> |
| 448 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/SortedPackedLongBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>SortedPackedLongBinding</CODE></A></li> |
| 449 |
</ul> |
| 450 |
<li>Multi-value binding methods for packed integers with default natural |
| 451 |
sorting.</li> |
| 452 |
<ul> |
| 453 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedPackedInt(int)"><CODE>TupleOutput.writeSortedPackedInt(int)</CODE></A></li> |
| 454 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedPackedInt()"><CODE>TupleInput.readSortedPackedInt()</CODE></A></li> |
| 455 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#getSortedPackedIntByteLength()"><CODE>TupleInput.getSortedPackedIntByteLength()</CODE></A></li> |
| 456 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedPackedLong(long)"><CODE>TupleOutput.writeSortedPackedLong(long)</CODE></A></li> |
| 457 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedPackedLong()"><CODE>TupleInput.readSortedPackedLong()</CODE></A></li> |
| 458 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#getSortedPackedLongByteLength()"><CODE>TupleInput.getSortedPackedLongByteLength()</CODE></A></li> |
| 459 |
</ul> |
| 460 |
</ul> |
| 461 |
|
| 462 |
<p>The unsorted packed integer format is an older, legacy format that is used |
| 463 |
internally and supported for compatibility. It stores values in the inclusive |
| 464 |
range [-119,119] in a single byte. Because default natural sorting is not |
| 465 |
supported, this format should not be used for keys. However, it so happens |
| 466 |
that packed integers in the inclusive range [0,630] are sorted correctly by |
| 467 |
default, and this may be useful for some applications.</p> |
| 468 |
<ul> |
| 469 |
<li>Single-value binding classes for legacy, unsorted packed integers.</li> |
| 470 |
<ul> |
| 471 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/PackedIntegerBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>PackedIntegerBinding</CODE></A></li> |
| 472 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/PackedLongBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>PackedLongBinding</CODE></A></li> |
| 473 |
</ul> |
| 474 |
<li>Multi-value binding methods for legacy, unsorted packed integers.</li> |
| 475 |
<ul> |
| 476 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writePackedInt(int)"><CODE>TupleOutput.writePackedInt(int)</CODE></A></li> |
| 477 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readPackedInt()"><CODE>TupleInput.readPackedInt()</CODE></A></li> |
| 478 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#getPackedIntByteLength()"><CODE>TupleInput.getPackedIntByteLength()</CODE></A></li> |
| 479 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writePackedLong(long)"><CODE>TupleOutput.writePackedLong(long)</CODE></A></li> |
| 480 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readPackedLong()"><CODE>TupleInput.readPackedLong()</CODE></A></li> |
| 481 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#getPackedLongByteLength()"><CODE>TupleInput.getPackedLongByteLength()</CODE></A></li> |
| 482 |
</ul> |
| 483 |
</ul> |
| 484 |
|
| 485 |
<h4>BigInteger Formats</h4> |
| 486 |
|
| 487 |
<p>All <code>BigInteger</code> formats support default natural sorting.</p> |
| 488 |
|
| 489 |
<p><code>BigInteger</code> values are variable length and are stored as signed |
| 490 |
values with a preceding byte length. The length has the same sign as the |
| 491 |
value, in order to support default natural sorting.</p> |
| 492 |
|
| 493 |
<p>The length is stored as a 2-byte (short), fixed size, signed integer. |
| 494 |
Supported values are therefore limited to those with a byte array (<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/math/BigInteger.html?is-external=true#toByteArray()" title="class or interface in java.math"><CODE>BigInteger.toByteArray()</CODE></A>) representation with a size of 0x7fff bytes |
| 495 |
or less. The maximum <code>BigInteger</code> value is (2<sup>0x3fff7</sup> - 1) and |
| 496 |
the minimum value is (-2<sup>0x3fff7</sup>).</p> |
| 497 |
|
| 498 |
<ul> |
| 499 |
<li>Single-value binding classes for <code>BigInteger</code> values.</li> |
| 500 |
<ul> |
| 501 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/BigIntegerBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>BigIntegerBinding</CODE></A></li> |
| 502 |
</ul> |
| 503 |
<li>Multi-value binding methods for <code>BigInteger</code> values.</li> |
| 504 |
<ul> |
| 505 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBigInteger(java.math.BigInteger)"><CODE>TupleOutput.writeBigInteger(java.math.BigInteger)</CODE></A></li> |
| 506 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBigInteger()"><CODE>TupleInput.readBigInteger()</CODE></A></li> |
| 507 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#getBigIntegerByteLength(java.math.BigInteger)"><CODE>TupleOutput.getBigIntegerByteLength(java.math.BigInteger)</CODE></A></li> |
| 508 |
</ul> |
| 509 |
</ul> |
| 510 |
|
| 511 |
<h3><a name="floatFormats">Floating Point Formats</a></h3> |
| 512 |
|
| 513 |
<p>Floats and doubles are stored in a fixed size, 4 and 8 byte format, |
| 514 |
respectively. Floats and doubles are stored using two different |
| 515 |
representations: a representation with default natural sorting, and an |
| 516 |
unsorted, integer-bit (IEEE 754) representation. For new applications, the |
| 517 |
format that supports default natural sorting should normally be used. There is |
| 518 |
no performance advantage to using the unsorted format.</p> |
| 519 |
|
| 520 |
<p>For <code>float</code> values, <code>Float.floatToIntBits</code> and the following |
| 521 |
bit manipulations are used to convert the signed float value to a |
| 522 |
representation that is sorted correctly by default.</p> |
| 523 |
<pre> |
| 524 |
int intVal = Float.floatToIntBits(val); |
| 525 |
intVal ^= (intVal < 0) ? 0xffffffff : 0x80000000; |
| 526 |
</pre> |
| 527 |
|
| 528 |
<p>For <code>double</code> values, <code>Float.doubleToLongBits</code> and the |
| 529 |
following bit manipulations are used to convert the signed double value to a |
| 530 |
representation that is sorted correctly by default.</p> |
| 531 |
<pre> |
| 532 |
long longVal = Double.doubleToLongBits(val); |
| 533 |
longVal ^= (longVal < 0) ? 0xffffffffffffffffL : 0x8000000000000000L; |
| 534 |
</pre> |
| 535 |
|
| 536 |
<p>In both cases, the resulting <code>int</code> or <code>long</code> value is stored as |
| 537 |
an unsigned value.</p> |
| 538 |
|
| 539 |
<ul> |
| 540 |
<li>Single-value binding classes for <code>float</code> and <code>double</code> values |
| 541 |
with default natural sorting.</li> |
| 542 |
<ul> |
| 543 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/SortedFloatBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>SortedFloatBinding</CODE></A></li> |
| 544 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/SortedDoubleBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>SortedDoubleBinding</CODE></A></li> |
| 545 |
</ul> |
| 546 |
<li>Multi-value binding methods for <code>float</code> and <code>double</code> values |
| 547 |
with default natural sorting.</li> |
| 548 |
<ul> |
| 549 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedFloat(float)"><CODE>TupleOutput.writeSortedFloat(float)</CODE></A></li> |
| 550 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedFloat()"><CODE>TupleInput.readSortedFloat()</CODE></A></li> |
| 551 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedDouble(double)"><CODE>TupleOutput.writeSortedDouble(double)</CODE></A></li> |
| 552 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedDouble()"><CODE>TupleInput.readSortedDouble()</CODE></A></li> |
| 553 |
</ul> |
| 554 |
</ul> |
| 555 |
|
| 556 |
<p>The unsorted floating point format is an older, legacy format that is |
| 557 |
supported for compatibility. With this format, only zero and positive values |
| 558 |
have default natural sorting; negative values do not.</p> |
| 559 |
|
| 560 |
<ul> |
| 561 |
<li>Single-value binding classes for legacy, unsorted <code>float</code> and <code>double</code> values.</li> |
| 562 |
<ul> |
| 563 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/FloatBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>FloatBinding</CODE></A></li> |
| 564 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/DoubleBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>DoubleBinding</CODE></A></li> |
| 565 |
</ul> |
| 566 |
<li>Multi-value binding methods for legacy, unsorted <code>float</code> and <code>double</code> values.</li> |
| 567 |
<ul> |
| 568 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeFloat(float)"><CODE>TupleOutput.writeFloat(float)</CODE></A></li> |
| 569 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readFloat()"><CODE>TupleInput.readFloat()</CODE></A></li> |
| 570 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeDouble(double)"><CODE>TupleOutput.writeDouble(double)</CODE></A></li> |
| 571 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readDouble()"><CODE>TupleInput.readDouble()</CODE></A></li> |
| 572 |
</ul> |
| 573 |
</ul> |
| 574 |
|
| 575 |
<h3><a name="bigDecimalFormats">BigDecimal Formats</a></h3> |
| 576 |
|
| 577 |
<p><code>BigDecimal</code> values are stored using two different, variable length |
| 578 |
representations: a representation that supports default natural sorting, and an |
| 579 |
unsorted representation. Differences between the two formats are: |
| 580 |
<ul> |
| 581 |
<li>The <code>BigDecimal</code> format with default natural sorting should normally |
| 582 |
be used for database keys.</li> |
| 583 |
<ul> |
| 584 |
<li>Default natural sorting <em>is</em> supported.</li> |
| 585 |
<li>The stored value is around 3 bytes larger than the unsorted format, |
| 586 |
more or less, and is a minimum of 8 bytes.</li> |
| 587 |
<li>More computation is required for serialization than the unsorted |
| 588 |
format.</li> |
| 589 |
<li>Trailing zeros after the decimal place are stripped, meaning that |
| 590 |
precision is not preserved.</li> |
| 591 |
</ul> |
| 592 |
<li>The unsorted <code>BigDecimal</code> format should normally be used for non-key |
| 593 |
values.</li> |
| 594 |
<ul> |
| 595 |
<li>Default natural sorting is <em>not</em> supported.</li> |
| 596 |
<li>The stored value is around 3 bytes smaller than the sorted format, more |
| 597 |
or less, and is a minimum of 3 bytes.</li> |
| 598 |
<li>Less computation is required for serialization than the sorted |
| 599 |
format.</li> |
| 600 |
<li>Trailing zeros after the decimal place are preserved, meaning that |
| 601 |
precision is preserved.</li> |
| 602 |
</ul> |
| 603 |
</ul> |
| 604 |
|
| 605 |
<p>Both formats store the scale or exponent separately from the unscaled value, |
| 606 |
and the stored size does not increase proportionally as the absolute value of |
| 607 |
the scale or exponent increases.</p> |
| 608 |
|
| 609 |
<ul> |
| 610 |
<li>Single-value binding classes for <code>BigDecimal</code> values with default |
| 611 |
natural sorting.</li> |
| 612 |
<ul> |
| 613 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/SortedBigDecimalBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>SortedBigDecimalBinding</CODE></A></li> |
| 614 |
</ul> |
| 615 |
<li>Multi-value binding methods for <code>BigDecimal</code> values with default |
| 616 |
natural sorting.</li> |
| 617 |
<ul> |
| 618 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedBigDecimal(java.math.BigDecimal)"><CODE>TupleOutput.writeSortedBigDecimal(java.math.BigDecimal)</CODE></A></li> |
| 619 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#getSortedBigDecimalMaxByteLength(java.math.BigDecimal)"><CODE>TupleOutput.getSortedBigDecimalMaxByteLength(java.math.BigDecimal)</CODE></A></li> |
| 620 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedBigDecimal()"><CODE>TupleInput.readSortedBigDecimal()</CODE></A></li> |
| 621 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#getSortedBigDecimalByteLength()"><CODE>TupleInput.getSortedBigDecimalByteLength()</CODE></A></li> |
| 622 |
</ul> |
| 623 |
<li>Single-value binding classes for unsorted <code>BigDecimal</code> values.</li> |
| 624 |
<ul> |
| 625 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/BigDecimalBinding.html" title="class in com.sleepycat.bind.tuple"><CODE>BigDecimalBinding</CODE></A></li> |
| 626 |
</ul> |
| 627 |
<li>Multi-value binding methods for unsorted <code>BigDecimal</code> values.</li> |
| 628 |
<ul> |
| 629 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBigDecimal(java.math.BigDecimal)"><CODE>TupleOutput.writeBigDecimal(java.math.BigDecimal)</CODE></A></li> |
| 630 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleOutput.html#getBigDecimalMaxByteLength(java.math.BigDecimal)"><CODE>TupleOutput.getBigDecimalMaxByteLength(java.math.BigDecimal)</CODE></A></li> |
| 631 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBigDecimal()"><CODE>TupleInput.readBigDecimal()</CODE></A></li> |
| 632 |
<li><A HREF="../../../../com/sleepycat/bind/tuple/TupleInput.html#getBigDecimalByteLength()"><CODE>TupleInput.getBigDecimalByteLength()</CODE></A></li> |
| 633 |
</ul> |
| 634 |
</ul> |
| 635 |
<P> |
| 636 |
|
| 637 |
<P> |
| 638 |
<DL> |
| 639 |
</DL> |
| 640 |
<HR> |
| 641 |
|
| 642 |
|
| 643 |
|
| 644 |
<A NAME="navbar_bottom"></A> |
| 645 |
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
| 646 |
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| 647 |
<TR> |
| 648 |
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| 649 |
<A NAME="navbar_bottom_firstrow"></A> |
| 650 |
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| 651 |
<TR ALIGN="center" VALIGN="top"> |
| 652 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| 653 |
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD> |
| 654 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD> |
| 655 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> |
| 656 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| 657 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| 658 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| 659 |
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| 660 |
</TR> |
| 661 |
</TABLE> |
| 662 |
</TD> |
| 663 |
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| 664 |
<b>Berkeley DB</b><br><font size="-1"> version 5.3.28</font></EM> |
| 665 |
</TD> |
| 666 |
</TR> |
| 667 |
|
| 668 |
<TR> |
| 669 |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| 670 |
<A HREF="../../../../com/sleepycat/bind/serial/package-summary.html"><B>PREV PACKAGE</B></A> |
| 671 |
<A HREF="../../../../com/sleepycat/collections/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD> |
| 672 |
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| 673 |
<A HREF="../../../../index.html?com/sleepycat/bind/tuple/package-summary.html" target="_top"><B>FRAMES</B></A> |
| 674 |
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A> |
| 675 |
<SCRIPT type="text/javascript"> |
| 676 |
<!-- |
| 677 |
if(window==top) { |
| 678 |
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| 679 |
} |
| 680 |
//--> |
| 681 |
</SCRIPT> |
| 682 |
<NOSCRIPT> |
| 683 |
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> |
| 684 |
</NOSCRIPT> |
| 685 |
|
| 686 |
|
| 687 |
</FONT></TD> |
| 688 |
</TR> |
| 689 |
</TABLE> |
| 690 |
<A NAME="skip-navbar_bottom"></A> |
| 691 |
|
| 692 |
|
| 693 |
<HR> |
| 694 |
<font size=1>Copyright (c) 1996, 2013 Oracle and/or its affiliates. All rights reserved.</font> |
| 695 |
</BODY> |
| 696 |
</HTML> |