je/docs/java/com/sleepycat/bind/tuple/package-summary.html
2021-06-06 13:46:45 -04:00

754 lines
42 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_151) on Tue Oct 31 17:36:47 EDT 2017 -->
<title>com.sleepycat.bind.tuple (Oracle - Berkeley DB Java Edition API)</title>
<meta name="date" content="2017-10-31">
<link rel="stylesheet" type="text/css" href="../../../../style.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="com.sleepycat.bind.tuple (Oracle - Berkeley DB Java Edition API)";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/sleepycat/bind/serial/package-summary.html">Prev&nbsp;Package</a></li>
<li><a href="../../../../com/sleepycat/collections/package-summary.html">Next&nbsp;Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/sleepycat/bind/tuple/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package&nbsp;com.sleepycat.bind.tuple</h1>
<div class="docSummary">
<div class="block">Bindings that use sequences of primitive fields, or tuples.</div>
</div>
<p>See:&nbsp;<a href="#package.description">Description</a></p>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation">
<caption><span>Interface Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/MarshalledTupleEntry.html" title="interface in com.sleepycat.bind.tuple">MarshalledTupleEntry</a></td>
<td class="colLast">
<div class="block">A marshalling interface implemented by key, data or entity classes that
are represented as tuples.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/MarshalledTupleKeyEntity.html" title="interface in com.sleepycat.bind.tuple">MarshalledTupleKeyEntity</a></td>
<td class="colLast">
<div class="block">A marshalling interface implemented by entity classes that represent keys as
tuples.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="typeSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/BigDecimalBinding.html" title="class in com.sleepycat.bind.tuple">BigDecimalBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for an unsorted <code>BigDecimal</code>
value.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/BigIntegerBinding.html" title="class in com.sleepycat.bind.tuple">BigIntegerBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a <code>BigInteger</code> value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/BooleanBinding.html" title="class in com.sleepycat.bind.tuple">BooleanBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a <code>Boolean</code> primitive
wrapper or a <code>boolean</code> primitive.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/ByteBinding.html" title="class in com.sleepycat.bind.tuple">ByteBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a <code>Byte</code> primitive
wrapper or a <code>byte</code> primitive.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/CharacterBinding.html" title="class in com.sleepycat.bind.tuple">CharacterBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a <code>Character</code> primitive
wrapper or a <code>char</code> primitive.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/DoubleBinding.html" title="class in com.sleepycat.bind.tuple">DoubleBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for an unsorted <code>Double</code>
primitive wrapper or an unsorted <code>double</code> primitive.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/FloatBinding.html" title="class in com.sleepycat.bind.tuple">FloatBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for an unsorted <code>Float</code>
primitive wrapper or an unsorted <code>float</code> primitive.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/IntegerBinding.html" title="class in com.sleepycat.bind.tuple">IntegerBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a <code>Integer</code> primitive
wrapper or an <code>int</code> primitive.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/LongBinding.html" title="class in com.sleepycat.bind.tuple">LongBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a <code>Long</code> primitive
wrapper or a <code>long</code> primitive.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/PackedIntegerBinding.html" title="class in com.sleepycat.bind.tuple">PackedIntegerBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for an unsorted <code>Integer</code>
primitive wrapper or an unsorted <code>int</code> primitive, that stores the
value in the smallest number of bytes possible.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/PackedLongBinding.html" title="class in com.sleepycat.bind.tuple">PackedLongBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for an unsorted <code>Long</code>
primitive wrapper or an unsorted <code>long</code> primitive, that stores
the value in the smallest number of bytes possible.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/ShortBinding.html" title="class in com.sleepycat.bind.tuple">ShortBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a <code>Short</code> primitive
wrapper or a <code>short</code> primitive.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/SortedBigDecimalBinding.html" title="class in com.sleepycat.bind.tuple">SortedBigDecimalBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a sorted <code>BigDecimal</code>
value.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/SortedDoubleBinding.html" title="class in com.sleepycat.bind.tuple">SortedDoubleBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a sorted <code>Double</code>
primitive wrapper or a sorted <code>double</code> primitive.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/SortedFloatBinding.html" title="class in com.sleepycat.bind.tuple">SortedFloatBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a sorted <code>Float</code>
primitive wrapper or sorted a <code>float</code> primitive.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/SortedPackedIntegerBinding.html" title="class in com.sleepycat.bind.tuple">SortedPackedIntegerBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a sorted <code>Integer</code>
primitive wrapper or a sorted <code>int</code> primitive, that stores the
value in the smallest number of bytes possible.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/SortedPackedLongBinding.html" title="class in com.sleepycat.bind.tuple">SortedPackedLongBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a sorted <code>Long</code>
primitive wrapper or a sorted <code>long</code> primitive, that stores the
value in the smallest number of bytes possible.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/StringBinding.html" title="class in com.sleepycat.bind.tuple">StringBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> for a simple <code>String</code> value.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleBase.html" title="class in com.sleepycat.bind.tuple">TupleBase</a>&lt;E&gt;</td>
<td class="colLast">
<div class="block">A base class for tuple bindings and tuple key creators that provides control
over the allocation of the output buffer.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleBinding.html" title="class in com.sleepycat.bind.tuple">TupleBinding</a>&lt;E&gt;</td>
<td class="colLast">
<div class="block">An abstract <code>EntryBinding</code> that treats a key or data entry as a
tuple; it includes predefined bindings for Java primitive types.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html" title="class in com.sleepycat.bind.tuple">TupleInput</a></td>
<td class="colLast">
<div class="block">An <code>InputStream</code> with <code>DataInput</code>-like methods for
reading tuple fields.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleInputBinding.html" title="class in com.sleepycat.bind.tuple">TupleInputBinding</a></td>
<td class="colLast">
<div class="block">A concrete <code>EntryBinding</code> that uses the <code>TupleInput</code>
object as the key or data object.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleMarshalledBinding.html" title="class in com.sleepycat.bind.tuple">TupleMarshalledBinding</a>&lt;E extends <a href="../../../../com/sleepycat/bind/tuple/MarshalledTupleEntry.html" title="interface in com.sleepycat.bind.tuple">MarshalledTupleEntry</a>&gt;</td>
<td class="colLast">
<div class="block">A concrete <code>TupleBinding</code> that delegates to the
<code>MarshalledTupleEntry</code> interface of the data or key object.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html" title="class in com.sleepycat.bind.tuple">TupleOutput</a></td>
<td class="colLast">
<div class="block">An <code>OutputStream</code> with <code>DataOutput</code>-like methods for
writing tuple fields.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleTupleBinding.html" title="class in com.sleepycat.bind.tuple">TupleTupleBinding</a>&lt;E&gt;</td>
<td class="colLast">
<div class="block">An abstract <code>EntityBinding</code> that treats an entity's key entry and
data entry as tuples.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleTupleKeyCreator.html" title="class in com.sleepycat.bind.tuple">TupleTupleKeyCreator</a>&lt;E&gt;</td>
<td class="colLast">
<div class="block">An abstract key creator that uses a tuple key and a tuple data entry.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleTupleMarshalledBinding.html" title="class in com.sleepycat.bind.tuple">TupleTupleMarshalledBinding</a>&lt;E extends <a href="../../../../com/sleepycat/bind/tuple/MarshalledTupleEntry.html" title="interface in com.sleepycat.bind.tuple">MarshalledTupleEntry</a> &amp; <a href="../../../../com/sleepycat/bind/tuple/MarshalledTupleKeyEntity.html" title="interface in com.sleepycat.bind.tuple">MarshalledTupleKeyEntity</a>&gt;</td>
<td class="colLast">
<div class="block">A concrete <code>TupleTupleBinding</code> that delegates to the
<code>MarshalledTupleEntry</code> and
<code>MarshalledTupleKeyEntity</code> interfaces of the entity class.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../com/sleepycat/bind/tuple/TupleTupleMarshalledKeyCreator.html" title="class in com.sleepycat.bind.tuple">TupleTupleMarshalledKeyCreator</a>&lt;E extends <a href="../../../../com/sleepycat/bind/tuple/MarshalledTupleEntry.html" title="interface in com.sleepycat.bind.tuple">MarshalledTupleEntry</a> &amp; <a href="../../../../com/sleepycat/bind/tuple/MarshalledTupleKeyEntity.html" title="interface in com.sleepycat.bind.tuple">MarshalledTupleKeyEntity</a>&gt;</td>
<td class="colLast">
<div class="block">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>.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
<a name="package.description">
<!-- -->
</a>
<h2 title="Package com.sleepycat.bind.tuple Description">Package com.sleepycat.bind.tuple Description</h2>
<div class="block">Bindings that use sequences of primitive fields, or tuples.
<!-- begin JE only -->
For a general discussion of bindings, see the
<a href="../../../../../GettingStartedGuide/bindAPI.html"
target="_top">Getting Started Guide</a>.
<!-- end JE only -->
<h2><a name="formats">Tuple Formats</a></h2>
<p>The serialization format for tuple bindings are designed for compactness,
serialization speed and proper default sorting.</p>
<p>When a format is used for database keys, it is important to use default
sorting for best performance. Although a custom comparator may be specified
for a <a href="../../../../com/sleepycat/je/DatabaseConfig.html#setBtreeComparator-java.util.Comparator-"><code>database</code></a> or
<a
href="../../../../com/sleepycat/persist/model/KeyField.html#comparable">entity
index</a>, custom comparators often reduce performance because comparators are
called very frequently during Btree operations.</p>
<p>For proper default sorting, the byte array of the stored format must be
designed so that a byte-by-byte unsigned comparison results in the natural sort
order, as defined by the <code>Comparable.compareTo(T)</code> method of the
data type. For example, the natural sort order for integers is the standard
mathematical definition, and is implemented by <code>Integer.compareTo</code>,
<code>Long.compareTo</code>, etc. This is called <em>default natural
sorting</em>.</p>
<p>Although most tuple formats provide default natural sorting, not all of them
do. Certain formats do not provide default natural sorting for historical
reasons (see the discussion of packed integer and float formats below.) Other
formats sacrifice default natural sorting for other performance factors (see
the discussion of BigDecimal formats below.)</p>
<!-- begin JE only -->
<p>Another performance factor has to do with amount of memory used by keys in
the Btree. Keys are stored in their serialized form in the Btree. If keys are
small (currently 16 bytes or less), Btree memory can be optimized. Optimized
memory storage is based on the maximum size of all keys in a single Btree
node. A single Btree node holds N adjacent key values, where N is 128 by
default and can be <a href="../../../../com/sleepycat/je/DatabaseConfig.html#setNodeMaxEntries-int-"><code>configured</code></a> for each database or index.</p>
<!-- end JE only -->
<h3><a name="stringFormats">String Formats</a></h3>
<p>All <code>String</code> formats support default natural sorting.</p>
<p>Strings are stored as a byte array of UTF encoded characters, either where
the length must be known by the application, or the byte array is
zero-terminated. The UTF encoding is described below.</p>
<ul>
<li>Null strings are UTF encoded as { 0xFF }, which is not allowed in a
standard UTF encoding. This allows null strings, as distinct from empty or
zero length strings, to be represented. Using default sorting, null strings
will be ordered last.
</li>
<li>Zero (0x0000) character values are UTF encoded as non-zero values, and
therefore embedded zeros in the string are supported. The sequence { 0xC0,
0x80 } is used to encode a zero character. This UTF encoding is the same one
used by the native Java UTF libraries and is called
<a href="http://download.oracle.com/javase/6/docs/api/java/io/DataInput.html#modified-utf-8">Modified UTF-8</a>.
However, this encoding of zero does impact the lexicographical ordering, and
zeros will not be sorted first (the natural order) or last.
</li>
<li>For all character values other than zero, the standard UTF encoding is
used, and the default sorting is the same as the Unicode lexicographical
character ordering.
</li>
</ul>
<p>Binding classes and methods are provided for zero-terminated and
known-length <code>String</code> values.</p>
<ul>
<li>Single-value binding classes for zero-terminated <code>String</code>
values.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/StringBinding.html" title="class in com.sleepycat.bind.tuple"><code>StringBinding</code></a></li>
</ul>
<li>Multi-value binding methods for zero-terminated and known-length <code>String</code> values.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeString-java.lang.String-"><code>TupleOutput.writeString(String)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readString--"><code>TupleInput.readString()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#getStringByteLength--"><code>TupleInput.getStringByteLength()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeString-char:A-"><code>TupleOutput.writeString(char[])</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readString-char:A-"><code>TupleInput.readString(char[])</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readString-int-"><code>TupleInput.readString(int)</code></a></li>
</ul>
</ul>
<h3><a name="integerFormats">Integer Formats</a></h3>
<h4>Fixed Size Integer Formats</h4>
<p>All fixed size integer formats support default natural sorting.</p>
<p>The size of the stored value depends on the type, and ranges (as one would
expect) from 1 byte for type <code>byte</code> and class <code>Byte</code>, to 8 bytes for
type <code>long</code> and class <code>Long</code>.</p>
<p>Signed numbers are stored in the buffer in MSB (most significant byte first)
order with their sign bit (high-order bit) inverted to cause negative numbers
to be sorted first when comparing values as unsigned byte arrays, as done in a
database.</p>
<ul>
<li>Single-value binding classes for signed, fixed size integers.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/ByteBinding.html" title="class in com.sleepycat.bind.tuple"><code>ByteBinding</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/ShortBinding.html" title="class in com.sleepycat.bind.tuple"><code>ShortBinding</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/IntegerBinding.html" title="class in com.sleepycat.bind.tuple"><code>IntegerBinding</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/LongBinding.html" title="class in com.sleepycat.bind.tuple"><code>LongBinding</code></a></li>
</ul>
<li>Multi-value binding methods for signed, fixed size integers.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeByte-int-"><code>TupleOutput.writeByte(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readByte--"><code>TupleInput.readByte()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeShort-int-"><code>TupleOutput.writeShort(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readShort--"><code>TupleInput.readShort()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeInt-int-"><code>TupleOutput.writeInt(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readInt--"><code>TupleInput.readInt()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeLong-long-"><code>TupleOutput.writeLong(long)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readLong--"><code>TupleInput.readLong()</code></a></li>
</ul>
</ul>
<p>Unsigned numbers, including characters, are stored in MSB order with no
change to their sign bit. Arrays of characters and unsigned bytes may also be
stored and may be treated as <code>String</code> values. For booleans, <code>true</code>
is stored as the unsigned byte value one and <code>false</code> as the unsigned byte
value zero.</p>
<ul>
<li>Single-value binding classes for characters and booleans.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/BooleanBinding.html" title="class in com.sleepycat.bind.tuple"><code>BooleanBinding</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/CharacterBinding.html" title="class in com.sleepycat.bind.tuple"><code>CharacterBinding</code></a></li>
</ul>
<li>Multi-value binding methods for unsigned, fixed size integers, characters
and booleans.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBoolean-boolean-"><code>TupleOutput.writeBoolean(boolean)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBoolean--"><code>TupleInput.readBoolean()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeChar-int-"><code>TupleOutput.writeChar(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readChar--"><code>TupleInput.readChar()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeUnsignedByte-int-"><code>TupleOutput.writeUnsignedByte(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readUnsignedByte--"><code>TupleInput.readUnsignedByte()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeUnsignedShort-int-"><code>TupleOutput.writeUnsignedShort(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readUnsignedShort--"><code>TupleInput.readUnsignedShort()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeUnsignedInt-long-"><code>TupleOutput.writeUnsignedInt(long)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readUnsignedInt--"><code>TupleInput.readUnsignedInt()</code></a></li>
</ul>
<li>Multi-value binding methods for character arrays and unsigned byte arrays
that may be treated as <code>String</code> values.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeChars-java.lang.String-"><code>TupleOutput.writeChars(String)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readChars-int-"><code>TupleInput.readChars(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeChars-char:A-"><code>TupleOutput.writeChars(char[])</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readChars-char:A-"><code>TupleInput.readChars(char[])</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBytes-java.lang.String-"><code>TupleOutput.writeBytes(String)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBytes-int-"><code>TupleInput.readBytes(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBytes-char:A-"><code>TupleOutput.writeBytes(char[])</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBytes-char:A-"><code>TupleInput.readBytes(char[])</code></a></li>
</ul>
</ul>
<h4>Packed Integer Formats</h4>
<p>The packed integer format stores integers with small absolute values in a
single byte. The size increases as the absolute value increases, up to a
maximum of 5 bytes for <code>int</code> values and 9 bytes for <code>long</code>
values.</p>
<p>The packed integer format can be used for integer values between <code>Long.MIN_VALUE</code> and <code>Long.MAX_VALUE</code>. However,
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>
<p>Because the same packed format is used for <code>int</code> and <code>long</code>
values, stored <code>int</code> values may be expanded to <code>long</code> values
without introducing a format incompatibility. In other words, you can treat
previously stored packed <code>int</code> values as packed <code>long</code> values.</p>
<p>Packed integer formats come in two varieties: those that support default
natural sorting and those that don't. The formats of the two varieties are
incompatible. For new applications, the format that supports default natural
sorting should normally be used. There is no performance advantage to using
the unsorted format.</p>
<p>The format with support for default natural sorting stores values in the
inclusive range [-119,120] in a single byte.</p>
<ul>
<li>Single-value binding classes for packed integers with default natural
sorting.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/SortedPackedIntegerBinding.html" title="class in com.sleepycat.bind.tuple"><code>SortedPackedIntegerBinding</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/SortedPackedLongBinding.html" title="class in com.sleepycat.bind.tuple"><code>SortedPackedLongBinding</code></a></li>
</ul>
<li>Multi-value binding methods for packed integers with default natural
sorting.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedPackedInt-int-"><code>TupleOutput.writeSortedPackedInt(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedPackedInt--"><code>TupleInput.readSortedPackedInt()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#getSortedPackedIntByteLength--"><code>TupleInput.getSortedPackedIntByteLength()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedPackedLong-long-"><code>TupleOutput.writeSortedPackedLong(long)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedPackedLong--"><code>TupleInput.readSortedPackedLong()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#getSortedPackedLongByteLength--"><code>TupleInput.getSortedPackedLongByteLength()</code></a></li>
</ul>
</ul>
<p>The unsorted packed integer format is an older, legacy format that is used
internally and supported for compatibility. It stores values in the inclusive
range [-119,119] in a single byte. Because default natural sorting is not
supported, this format should not be used for keys. However, it so happens
that packed integers in the inclusive range [0,630] are sorted correctly by
default, and this may be useful for some applications.</p>
<ul>
<li>Single-value binding classes for legacy, unsorted packed integers.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/PackedIntegerBinding.html" title="class in com.sleepycat.bind.tuple"><code>PackedIntegerBinding</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/PackedLongBinding.html" title="class in com.sleepycat.bind.tuple"><code>PackedLongBinding</code></a></li>
</ul>
<li>Multi-value binding methods for legacy, unsorted packed integers.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writePackedInt-int-"><code>TupleOutput.writePackedInt(int)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readPackedInt--"><code>TupleInput.readPackedInt()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#getPackedIntByteLength--"><code>TupleInput.getPackedIntByteLength()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writePackedLong-long-"><code>TupleOutput.writePackedLong(long)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readPackedLong--"><code>TupleInput.readPackedLong()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#getPackedLongByteLength--"><code>TupleInput.getPackedLongByteLength()</code></a></li>
</ul>
</ul>
<h4>BigInteger Formats</h4>
<p>All <code>BigInteger</code> formats support default natural sorting.</p>
<p><code>BigInteger</code> values are variable length and are stored as signed
values with a preceding byte length. The length has the same sign as the
value, in order to support default natural sorting.</p>
<p>The length is stored as a 2-byte (short), fixed size, signed integer.
Supported values are therefore limited to those with a byte array (<code>BigInteger.toByteArray()</code>) representation with a size of 0x7fff bytes
or less. The maximum <code>BigInteger</code> value is (2<sup>0x3fff7</sup> - 1) and
the minimum value is (-2<sup>0x3fff7</sup>).</p>
<ul>
<li>Single-value binding classes for <code>BigInteger</code> values.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/BigIntegerBinding.html" title="class in com.sleepycat.bind.tuple"><code>BigIntegerBinding</code></a></li>
</ul>
<li>Multi-value binding methods for <code>BigInteger</code> values.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBigInteger-java.math.BigInteger-"><code>TupleOutput.writeBigInteger(java.math.BigInteger)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBigInteger--"><code>TupleInput.readBigInteger()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#getBigIntegerByteLength-java.math.BigInteger-"><code>TupleOutput.getBigIntegerByteLength(java.math.BigInteger)</code></a></li>
</ul>
</ul>
<h3><a name="floatFormats">Floating Point Formats</a></h3>
<p>Floats and doubles are stored in a fixed size, 4 and 8 byte format,
respectively. Floats and doubles are stored using two different
representations: a representation with default natural sorting, and an
unsorted, integer-bit (IEEE 754) representation. For new applications, the
format that supports default natural sorting should normally be used. There is
no performance advantage to using the unsorted format.</p>
<p>For <code>float</code> values, <code>Float.floatToIntBits</code> and the following
bit manipulations are used to convert the signed float value to a
representation that is sorted correctly by default.</p>
<pre>
int intVal = Float.floatToIntBits(val);
intVal ^= (intVal &lt; 0) ? 0xffffffff : 0x80000000;
</pre>
<p>For <code>double</code> values, <code>Float.doubleToLongBits</code> and the
following bit manipulations are used to convert the signed double value to a
representation that is sorted correctly by default.</p>
<pre>
long longVal = Double.doubleToLongBits(val);
longVal ^= (longVal &lt; 0) ? 0xffffffffffffffffL : 0x8000000000000000L;
</pre>
<p>In both cases, the resulting <code>int</code> or <code>long</code> value is stored as
an unsigned value.</p>
<ul>
<li>Single-value binding classes for <code>float</code> and <code>double</code> values
with default natural sorting.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/SortedFloatBinding.html" title="class in com.sleepycat.bind.tuple"><code>SortedFloatBinding</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/SortedDoubleBinding.html" title="class in com.sleepycat.bind.tuple"><code>SortedDoubleBinding</code></a></li>
</ul>
<li>Multi-value binding methods for <code>float</code> and <code>double</code> values
with default natural sorting.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedFloat-float-"><code>TupleOutput.writeSortedFloat(float)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedFloat--"><code>TupleInput.readSortedFloat()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedDouble-double-"><code>TupleOutput.writeSortedDouble(double)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedDouble--"><code>TupleInput.readSortedDouble()</code></a></li>
</ul>
</ul>
<p>The unsorted floating point format is an older, legacy format that is
supported for compatibility. With this format, only zero and positive values
have default natural sorting; negative values do not.</p>
<ul>
<li>Single-value binding classes for legacy, unsorted <code>float</code> and <code>double</code> values.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/FloatBinding.html" title="class in com.sleepycat.bind.tuple"><code>FloatBinding</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/DoubleBinding.html" title="class in com.sleepycat.bind.tuple"><code>DoubleBinding</code></a></li>
</ul>
<li>Multi-value binding methods for legacy, unsorted <code>float</code> and <code>double</code> values.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeFloat-float-"><code>TupleOutput.writeFloat(float)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readFloat--"><code>TupleInput.readFloat()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeDouble-double-"><code>TupleOutput.writeDouble(double)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readDouble--"><code>TupleInput.readDouble()</code></a></li>
</ul>
</ul>
<h3><a name="bigDecimalFormats">BigDecimal Formats</a></h3>
<p><code>BigDecimal</code> values are stored using two different, variable length
representations: a representation that supports default natural sorting, and an
unsorted representation. Differences between the two formats are:
<ul>
<li>The <code>BigDecimal</code> format with default natural sorting should normally
be used for database keys.</li>
<ul>
<li>Default natural sorting <em>is</em> supported.</li>
<li>The stored value is around 3 bytes larger than the unsorted format,
more or less, and is a minimum of 8 bytes.</li>
<li>More computation is required for serialization than the unsorted
format.</li>
<li>Trailing zeros after the decimal place are stripped, meaning that
precision is not preserved.</li>
</ul>
<li>The unsorted <code>BigDecimal</code> format should normally be used for non-key
values.</li>
<ul>
<li>Default natural sorting is <em>not</em> supported.</li>
<li>The stored value is around 3 bytes smaller than the sorted format, more
or less, and is a minimum of 3 bytes.</li>
<li>Less computation is required for serialization than the sorted
format.</li>
<li>Trailing zeros after the decimal place are preserved, meaning that
precision is preserved.</li>
</ul>
</ul>
<p>Both formats store the scale or exponent separately from the unscaled value,
and the stored size does not increase proportionally as the absolute value of
the scale or exponent increases.</p>
<ul>
<li>Single-value binding classes for <code>BigDecimal</code> values with default
natural sorting.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/SortedBigDecimalBinding.html" title="class in com.sleepycat.bind.tuple"><code>SortedBigDecimalBinding</code></a></li>
</ul>
<li>Multi-value binding methods for <code>BigDecimal</code> values with default
natural sorting.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeSortedBigDecimal-java.math.BigDecimal-"><code>TupleOutput.writeSortedBigDecimal(java.math.BigDecimal)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#getSortedBigDecimalMaxByteLength-java.math.BigDecimal-"><code>TupleOutput.getSortedBigDecimalMaxByteLength(java.math.BigDecimal)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readSortedBigDecimal--"><code>TupleInput.readSortedBigDecimal()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#getSortedBigDecimalByteLength--"><code>TupleInput.getSortedBigDecimalByteLength()</code></a></li>
</ul>
<li>Single-value binding classes for unsorted <code>BigDecimal</code> values.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/BigDecimalBinding.html" title="class in com.sleepycat.bind.tuple"><code>BigDecimalBinding</code></a></li>
</ul>
<li>Multi-value binding methods for unsorted <code>BigDecimal</code> values.</li>
<ul>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#writeBigDecimal-java.math.BigDecimal-"><code>TupleOutput.writeBigDecimal(java.math.BigDecimal)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleOutput.html#getBigDecimalMaxByteLength-java.math.BigDecimal-"><code>TupleOutput.getBigDecimalMaxByteLength(java.math.BigDecimal)</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#readBigDecimal--"><code>TupleInput.readBigDecimal()</code></a></li>
<li><a href="../../../../com/sleepycat/bind/tuple/TupleInput.html#getBigDecimalByteLength--"><code>TupleInput.getBigDecimalByteLength()</code></a></li>
</ul>
</ul></div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar.bottom">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/sleepycat/bind/serial/package-summary.html">Prev&nbsp;Package</a></li>
<li><a href="../../../../com/sleepycat/collections/package-summary.html">Next&nbsp;Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/sleepycat/bind/tuple/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small><font size=1>Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.</font> </small></p>
</body>
</html>