<!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 (version 1.7.0_75) on Fri May 13 13:32:16 PDT 2016 --> <title>DatabaseEntry (Oracle - Berkeley DB Java API)</title> <meta name="date" content="2016-05-13"> <link rel="stylesheet" type="text/css" href="../../../style.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="DatabaseEntry (Oracle - Berkeley DB Java API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/DatabaseEntry.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"><em><b>Berkeley DB</b><br><font size="-1"> version 6.1.29</font></em></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db"><span class="strong">Prev Class</span></a></li> <li><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?com/sleepycat/db/DatabaseEntry.html" target="_top">Frames</a></li> <li><a href="DatabaseEntry.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All 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> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li><a href="#constructor_summary">Constr</a> | </li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li><a href="#constructor_detail">Constr</a> | </li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">com.sleepycat.db</div> <h2 title="Class DatabaseEntry" class="title">Class DatabaseEntry</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li>com.sleepycat.db.DatabaseEntry</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Direct Known Subclasses:</dt> <dd><a href="../../../com/sleepycat/db/MultipleEntry.html" title="class in com.sleepycat.db">MultipleEntry</a></dd> </dl> <hr> <br> <pre>public class <span class="strong">DatabaseEntry</span> extends java.lang.Object</pre> <div class="block">Encodes database key and data items as a byte array. <p> Storage and retrieval for the <a href="../../../com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><code>Database</code></a> and <a href="../../../com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> methods are based on key/data pairs. Both key and data items are represented by DatabaseEntry objects. Key and data byte arrays may refer to arrays of zero length up to arrays of essentially unlimited length. <p> The DatabaseEntry class provides simple access to an underlying object whose elements can be examined or changed. DatabaseEntry objects can be subclassed, providing a way to associate with it additional data or references to other structures. <p> Access to DatabaseEntry objects is not re-entrant. In particular, if multiple threads simultaneously access the same DatabaseEntry object using <a href="../../../com/sleepycat/db/Database.html" title="class in com.sleepycat.db"><code>Database</code></a> or <a href="../../../com/sleepycat/db/Cursor.html" title="class in com.sleepycat.db"><code>Cursor</code></a> methods, the results are undefined. <p> DatabaseEntry objects may be used in conjunction with the object mapping support provided in the <a href="../../../com/sleepycat/bind/package-summary.html"><code>com.sleepycat.bind</code></a> package. <p> <h3>Input and Output Parameters</h3> <p> DatabaseEntry objects are used for both input data (when writing to a database or specifying a search parameter) and output data (when reading from a database). For certain methods, one parameter may be an input parameter and another may be an output parameter. For example, the <a href="../../../com/sleepycat/db/Database.html#get(com.sleepycat.db.Transaction,%20com.sleepycat.db.DatabaseEntry,%20com.sleepycat.db.DatabaseEntry,%20com.sleepycat.db.LockMode)"><code>Database.get(com.sleepycat.db.Transaction, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.LockMode)</code></a> method has an input key parameter and an output data parameter. The documentation for each method describes whether its parameters are input or output parameters. <p> For DatabaseEntry input parameters, the caller is responsible for initializing the data array of the DatabaseEntry. For DatabaseEntry output parameters, the method called will initialize the data array. <p> For DatabaseEntry output parameters, by default the method called will reuse the byte array in the DatabaseEntry, if the data returned fits in the byte array. This behavior can be configured with <a href="../../../com/sleepycat/db/DatabaseEntry.html#setReuseBuffer(boolean)"><code>setReuseBuffer(boolean)</code></a> or <a href="../../../com/sleepycat/db/DatabaseEntry.html#setUserBuffer(int,%20boolean)"><code>setUserBuffer(int, boolean)</code></a>. If an entry is configured to reuse the byte array (the default behavior), the length of the underlying byte array should not be used to determine the amount of data returned each time the entry is used as an output parameter, rather the <a href="../../../com/sleepycat/db/DatabaseEntry.html#getSize()"><code>getSize()</code></a> call should be used. If an entry is configured to not reuse the byte array, a new array is allocated each time the entry is used as an output parameter, so the application can safely keep a reference to the byte array returned by <a href="../../../com/sleepycat/db/DatabaseEntry.html#getData()"><code>getData()</code></a> without danger that the array will be overwritten in a subsequent call. <p> <h3>Offset and Size Properties</h3> <p> By default the Offset property is zero and the Size property is the length of the byte array. However, to allow for optimizations involving the partial use of a byte array, the Offset and Size may be set to non-default values. <p> For DatabaseEntry output parameters, the Size will always be set to the length of the returned data and the Offset will always be set to zero. <p> However, for DatabaseEntry input parameters the Offset and Size are set to non-default values by the built-in tuple and serial bindings. For example, with a tuple or serial binding the byte array is grown dynamically as data is output, and the Size is set to the number of bytes actually used. For a serial binding, the Offset is set to a non-zero value in order to implement an optimization having to do with the serialization stream header. <p> Therefore, for output DatabaseEntry parameters the application can assume that the Offset is zero and the Size is the length of the byte array. However, for input DatabaseEntry parameters the application should not make this assumption. In general, it is safest for the application to always honor the Size and Offset properties, rather than assuming they have default values. <p> <h3>Partial Offset and Length Properties</h3> <p> By default the specified data (byte array, offset and size) corresponds to the full stored key or data item. Optionally, the Partial property can be set to true, and the PartialOffset and PartialLength properties are used to specify the portion of the key or data item to be read or written. For details, see the <a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int,%20int,%20boolean)"><code>setPartial(int,int,boolean)</code></a> method. <p> Note that the Partial properties are set only by the caller. They will never be set by a Database or Cursor method, nor will they every be set by bindings. Therefore, the application can assume that the Partial properties are not set, unless the application itself sets them explicitly.</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd"> </span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#DatabaseEntry()">DatabaseEntry</a></strong>()</code> <div class="block">Construct a DatabaseEntry with null data.</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#DatabaseEntry(byte[])">DatabaseEntry</a></strong>(byte[] data)</code> <div class="block">Construct a DatabaseEntry with a given byte array.</div> </td> </tr> <tr class="altColor"> <td class="colOne"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#DatabaseEntry(byte[],%20int,%20int)">DatabaseEntry</a></strong>(byte[] data, int offset, int size)</code> <div class="block">Constructs a DatabaseEntry with a given byte array, offset and size.</div> </td> </tr> <tr class="rowColor"> <td class="colOne"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#DatabaseEntry(java.nio.ByteBuffer)">DatabaseEntry</a></strong>(java.nio.ByteBuffer data)</code> <div class="block">Construct a DatabaseEntry with a given native I/O buffer.</div> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd"> </span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#equals(java.lang.Object)">equals</a></strong>(java.lang.Object o)</code> <div class="block">Compares the data of two entries for byte-by-byte equality.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getBlob()">getBlob</a></strong>()</code> <div class="block">Return whether this DatabaseEntry is configured to be stored as a blob.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>byte[]</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getData()">getData</a></strong>()</code> <div class="block">Return the byte array.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>java.nio.ByteBuffer</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getDataNIO()">getDataNIO</a></strong>()</code> <div class="block">Return the java.nio.ByteBuffer.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getOffset()">getOffset</a></strong>()</code> <div class="block">Return the byte offset into the data array.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getPartial()">getPartial</a></strong>()</code> <div class="block">Return whether this DatabaseEntry is configured to read or write partial records.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getPartialLength()">getPartialLength</a></strong>()</code> <div class="block">Return the byte length of the partial record being read or written by the application, in bytes.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getPartialOffset()">getPartialOffset</a></strong>()</code> <div class="block">Return the offset of the partial record being read or written by the application, in bytes.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getReadOnly()">getReadOnly</a></strong>()</code> <div class="block">Return whether this DatabaseEntry is configured as read only.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getRecordNumber()">getRecordNumber</a></strong>()</code> <div class="block">Return the record number encoded in this entry's buffer.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getReuseBuffer()">getReuseBuffer</a></strong>()</code> <div class="block">Return true if the whether the entry is configured to reuse the buffer.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getSize()">getSize</a></strong>()</code> <div class="block">Return the byte size of the data array.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getUserBuffer()">getUserBuffer</a></strong>()</code> <div class="block">Return true if the whether the buffer in this entry is owned by the application.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#getUserBufferLength()">getUserBufferLength</a></strong>()</code> <div class="block">Return the length of the application's buffer.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#hashCode()">hashCode</a></strong>()</code> <div class="block">Returns a hash code based on the data value.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setBlob(boolean)">setBlob</a></strong>(boolean blob)</code> <div class="block">Configure this DatabaseEntry to be stored as a blob.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setData(byte[])">setData</a></strong>(byte[] data)</code> <div class="block">Sets the byte array.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setData(byte[],%20int,%20int)">setData</a></strong>(byte[] data, int offset, int size)</code> <div class="block">Sets the byte array, offset and size.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setDataNIO(java.nio.ByteBuffer)">setDataNIO</a></strong>(java.nio.ByteBuffer data)</code> <div class="block">Sets the java.nio.ByteBuffer.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setDataNIO(java.nio.ByteBuffer,%20int,%20int)">setDataNIO</a></strong>(java.nio.ByteBuffer data, int offset, int size)</code> <div class="block">Sets the java.nio.ByteBuffer (or the backing array if passed a non-direct ByteBuffer,) offset and size.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setOffset(int)">setOffset</a></strong>(int offset)</code> <div class="block">Set the byte offset into the data array.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(boolean)">setPartial</a></strong>(boolean partial)</code> <div class="block">Configure this DatabaseEntry to read or write partial records.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int,%20int,%20boolean)">setPartial</a></strong>(int doff, int dlen, boolean partial)</code> <div class="block">Configures this DatabaseEntry to read or write partial records.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartialLength(int)">setPartialLength</a></strong>(int dlen)</code> <div class="block">Set the byte length of the partial record being read or written by the application, in bytes.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartialOffset(int)">setPartialOffset</a></strong>(int doff)</code> <div class="block">Set the offset of the partial record being read or written by the application, in bytes.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setReadOnly(boolean)">setReadOnly</a></strong>(boolean readonly)</code> <div class="block">Configure this DatabaseEntry as read only.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setRecordNumber(int)">setRecordNumber</a></strong>(int recno)</code> <div class="block">Initialize the entry from a logical record number.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setReuseBuffer(boolean)">setReuseBuffer</a></strong>(boolean reuse)</code> <div class="block">Configures the entry to try to reuse the buffer before allocating a new one.</div> </td> </tr> <tr class="altColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setSize(int)">setSize</a></strong>(int size)</code> <div class="block">Set the byte size of the data array.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>void</code></td> <td class="colLast"><code><strong><a href="../../../com/sleepycat/db/DatabaseEntry.html#setUserBuffer(int,%20boolean)">setUserBuffer</a></strong>(int length, boolean usermem)</code> <div class="block">Configures the entry with an application-owned buffer.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class java.lang.Object</h3> <code>clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="DatabaseEntry()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>DatabaseEntry</h4> <pre>public DatabaseEntry()</pre> <div class="block">Construct a DatabaseEntry with null data. The offset and size are set to zero.</div> </li> </ul> <a name="DatabaseEntry(byte[])"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>DatabaseEntry</h4> <pre>public DatabaseEntry(byte[] data)</pre> <div class="block">Construct a DatabaseEntry with a given byte array. The offset is set to zero; the size is set to the length of the array, or to zero if null is passed. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - Byte array wrapped by the DatabaseEntry.</dd></dl> </li> </ul> <a name="DatabaseEntry(byte[], int, int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>DatabaseEntry</h4> <pre>public DatabaseEntry(byte[] data, int offset, int size)</pre> <div class="block">Constructs a DatabaseEntry with a given byte array, offset and size. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - Byte array wrapped by the DatabaseEntry.</dd><dd><code>offset</code> - Offset in the first byte in the byte array to be included.</dd><dd><code>size</code> - Number of bytes in the byte array to be included.</dd></dl> </li> </ul> <a name="DatabaseEntry(java.nio.ByteBuffer)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>DatabaseEntry</h4> <pre>public DatabaseEntry(java.nio.ByteBuffer data)</pre> <div class="block">Construct a DatabaseEntry with a given native I/O buffer. If the buffer is non-direct, the buffer's backing array is used. If the buffer is direct, the DatabaseEntry is configured with an application-owned buffer whose length is set to the ByteBuffer's capacity less its position. The DatabaseEntry's size is set to the ByteBuffer's limit less its position and the offset is set to buffer's position (adjusted by arrayOffset if the buffer is non-direct.) <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - NIO byte buffer wrapped by the DatabaseEntry.</dd></dl> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="setBlob(boolean)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setBlob</h4> <pre>public void setBlob(boolean blob)</pre> <div class="block">Configure this DatabaseEntry to be stored as a blob. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>blob</code> - Whether this DatabaseEntry is configured to be stored as a blob.</dd></dl> </li> </ul> <a name="getBlob()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getBlob</h4> <pre>public boolean getBlob()</pre> <div class="block">Return whether this DatabaseEntry is configured to be stored as a blob. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>Whether this DatabaseEntry is configured to be stored as a blob.</dd></dl> </li> </ul> <a name="getData()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getData</h4> <pre>public byte[] getData()</pre> <div class="block">Return the byte array. <p> For a DatabaseEntry that is used as an output parameter, the byte array will always be a newly allocated array. The byte array specified by the caller will not be used and may be null. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>The byte array.</dd></dl> </li> </ul> <a name="getDataNIO()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getDataNIO</h4> <pre>public java.nio.ByteBuffer getDataNIO()</pre> <div class="block">Return the java.nio.ByteBuffer. <p> Used to access the underlying data when the DatabaseEntry is configured to utilize a java.nio.ByteBuffer. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>The underlying java.nio.ByteBuffer.</dd></dl> </li> </ul> <a name="setData(byte[], int, int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setData</h4> <pre>public void setData(byte[] data, int offset, int size)</pre> <div class="block">Sets the byte array, offset and size. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - Byte array wrapped by the DatabaseEntry.</dd><dd><code>offset</code> - Offset in the first byte in the byte array to be included.</dd><dd><code>size</code> - Number of bytes in the byte array to be included.</dd></dl> </li> </ul> <a name="setData(byte[])"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setData</h4> <pre>public void setData(byte[] data)</pre> <div class="block">Sets the byte array. The offset is set to zero; the size is set to the length of the array, or to zero if null is passed. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - Byte array wrapped by the DatabaseEntry.</dd></dl> </li> </ul> <a name="setDataNIO(java.nio.ByteBuffer, int, int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setDataNIO</h4> <pre>public void setDataNIO(java.nio.ByteBuffer data, int offset, int size)</pre> <div class="block">Sets the java.nio.ByteBuffer (or the backing array if passed a non-direct ByteBuffer,) offset and size. If passed a direct ByteBuffer, the entry is configured with an application-owned buffer whose length is set to the ByteBuffer's capacity less the offset. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - java.nio.ByteBuffer wrapped by the DatabaseEntry.</dd><dd><code>offset</code> - int offset into the ByteBuffer where the DatabaseEntry data begins.</dd><dd><code>size</code> - int size of the ByteBuffer available.</dd></dl> </li> </ul> <a name="setDataNIO(java.nio.ByteBuffer)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setDataNIO</h4> <pre>public void setDataNIO(java.nio.ByteBuffer data)</pre> <div class="block">Sets the java.nio.ByteBuffer. The offset is set to the ByteBuffer's position; the size is set to the ByteBuffer's limit less its position, or to zero if null is passed. If the ByteBuffer is non-direct, the backing array will be used. If passed a direct ByteBuffer, the entry is configured with an application-owned buffer whose length is set to the ByteBuffer's capacity less its current position. No call to <a href="../../../com/sleepycat/db/DatabaseEntry.html#setUserBuffer(int,%20boolean)"><code>setUserBuffer(int, boolean)</code></a> is required after setting the ByteBuffer. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>data</code> - java.nio.ByteBuffer wrapped by the DatabaseEntry.</dd></dl> </li> </ul> <a name="getOffset()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getOffset</h4> <pre>public int getOffset()</pre> <div class="block">Return the byte offset into the data array. <p> For a DatabaseEntry that is used as an output parameter, the offset will always be zero. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>Offset in the first byte in the byte array to be included.</dd></dl> </li> </ul> <a name="setOffset(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setOffset</h4> <pre>public void setOffset(int offset)</pre> <div class="block">Set the byte offset into the data array. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>offset</code> - Offset in the first byte in the byte array to be included.</dd></dl> </li> </ul> <a name="getPartialLength()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getPartialLength</h4> <pre>public int getPartialLength()</pre> <div class="block">Return the byte length of the partial record being read or written by the application, in bytes. <p> Note that the Partial properties are set only by the caller. They will never be set by a Database or Cursor method. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>The byte length of the partial record being read or written by the application, in bytes. <p></dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int,%20int,%20boolean)"><code>setPartial(int,int,boolean)</code></a></dd></dl> </li> </ul> <a name="getPartialOffset()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getPartialOffset</h4> <pre>public int getPartialOffset()</pre> <div class="block">Return the offset of the partial record being read or written by the application, in bytes. <p> Note that the Partial properties are set only by the caller. They will never be set by a Database or Cursor method. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>The offset of the partial record being read or written by the application, in bytes. <p></dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int,%20int,%20boolean)"><code>setPartial(int,int,boolean)</code></a></dd></dl> </li> </ul> <a name="getPartial()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getPartial</h4> <pre>public boolean getPartial()</pre> <div class="block">Return whether this DatabaseEntry is configured to read or write partial records. <p> Note that the Partial properties are set only by the caller. They will never be set by a Database or Cursor method. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>Whether this DatabaseEntry is configured to read or write partial records. <p></dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int,%20int,%20boolean)"><code>setPartial(int,int,boolean)</code></a></dd></dl> </li> </ul> <a name="setPartialOffset(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setPartialOffset</h4> <pre>public void setPartialOffset(int doff)</pre> <div class="block">Set the offset of the partial record being read or written by the application, in bytes. <p> Note that the Partial properties are set only by the caller. They will never be set by a Database or Cursor method. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>doff</code> - The offset of the partial record being read or written by the application, in bytes. <p></dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int,%20int,%20boolean)"><code>setPartial(int,int,boolean)</code></a></dd></dl> </li> </ul> <a name="setPartialLength(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setPartialLength</h4> <pre>public void setPartialLength(int dlen)</pre> <div class="block">Set the byte length of the partial record being read or written by the application, in bytes. <p> Note that the Partial properties are set only by the caller. They will never be set by a Database or Cursor method. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>dlen</code> - The byte length of the partial record being read or written by the <p></dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int,%20int,%20boolean)"><code>application, in bytes.</code></a></dd></dl> </li> </ul> <a name="setPartial(boolean)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setPartial</h4> <pre>public void setPartial(boolean partial)</pre> <div class="block">Configure this DatabaseEntry to read or write partial records. <p> Note that the Partial properties are set only by the caller. They will never be set by a Database or Cursor method. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>partial</code> - Whether this DatabaseEntry is configured to read or write partial records. <p></dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int,%20int,%20boolean)"><code>setPartial(int,int,boolean)</code></a></dd></dl> </li> </ul> <a name="setPartial(int, int, boolean)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setPartial</h4> <pre>public void setPartial(int doff, int dlen, boolean partial)</pre> <div class="block">Configures this DatabaseEntry to read or write partial records. <p> Do partial retrieval or storage of an item. If the calling application is doing a retrieval, length bytes specified by <tt>dlen</tt>, starting at the offset set by <tt>doff</tt> bytes from the beginning of the retrieved data record are returned as if they comprised the entire record. If any or all of the specified bytes do not exist in the record, the get is successful, and any existing bytes are returned. <p> For example, if the data portion of a retrieved record was 100 bytes, and a partial retrieval was done using a DatabaseEntry having a partial length of 20 and a partial offset of 85, the retrieval would succeed and the retrieved data would be the last 15 bytes of the record. <p> If the calling application is storing an item, length bytes specified by <tt>dlen</tt>, starting at the offset set by <tt>doff</tt> bytes from the beginning of the specified key's data item are replaced by the data specified by the DatabaseEntry. If the partial length is smaller than the data, the record will grow; if the partial length is larger than the data, the record will shrink. If the specified bytes do not exist, the record will be extended using nul bytes as necessary, and the store will succeed. <p> It is an error to specify a partial key when performing a put operation of any kind. <p> It is an error to attempt a partial store using the <a href="../../../com/sleepycat/db/Database.html#put(com.sleepycat.db.Transaction,%20com.sleepycat.db.DatabaseEntry,%20com.sleepycat.db.DatabaseEntry)"><code>Database.put</code></a> method in a database that supports duplicate records. Partial stores in databases supporting duplicate records must be done using a cursor method. <p> Note that the Partial properties are set only by the caller. They will never be set by a Database or Cursor method. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>doff</code> - The offset of the partial record being read or written by the application, in bytes. <p></dd><dd><code>dlen</code> - The byte length of the partial record being read or written by the application, in bytes. <p></dd><dd><code>partial</code> - Whether this DatabaseEntry is configured to read or write partial records.</dd></dl> </li> </ul> <a name="getReadOnly()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getReadOnly</h4> <pre>public boolean getReadOnly()</pre> <div class="block">Return whether this DatabaseEntry is configured as read only. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>Whether this DatabaseEntry is configured as read only. <p></dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../com/sleepycat/db/DatabaseEntry.html#setReadOnly(boolean)"><code>setReadOnly(boolean)</code></a></dd></dl> </li> </ul> <a name="setReadOnly(boolean)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setReadOnly</h4> <pre>public void setReadOnly(boolean readonly)</pre> <div class="block">Configure this DatabaseEntry as read only. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>readonly</code> - Whether this DatabaseEntry is configured as read only.</dd></dl> </li> </ul> <a name="getRecordNumber()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getRecordNumber</h4> <pre>public int getRecordNumber()</pre> <div class="block">Return the record number encoded in this entry's buffer. <p> This method may be called at any time during the life of the application. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>The record number encoded in this entry's buffer.</dd></dl> </li> </ul> <a name="setRecordNumber(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setRecordNumber</h4> <pre>public void setRecordNumber(int recno)</pre> <div class="block">Initialize the entry from a logical record number. Record numbers are integer keys starting at 1. When this method is called the data, size and offset fields are implicitly set to hold a byte array representation of the integer key.</div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>recno</code> - the record number to be encoded</dd></dl> </li> </ul> <a name="getReuseBuffer()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getReuseBuffer</h4> <pre>public boolean getReuseBuffer()</pre> <div class="block">Return true if the whether the entry is configured to reuse the buffer. <p> This method may be called at any time during the life of the application. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>True if the whether the entry is configured to reuse the buffer.</dd></dl> </li> </ul> <a name="setReuseBuffer(boolean)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setReuseBuffer</h4> <pre>public void setReuseBuffer(boolean reuse)</pre> <div class="block">Configures the entry to try to reuse the buffer before allocating a new one. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>reuse</code> - whether to reuse the buffer</dd></dl> </li> </ul> <a name="getSize()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getSize</h4> <pre>public int getSize()</pre> <div class="block">Return the byte size of the data array. <p> For a DatabaseEntry that is used as an output parameter, the size will always be the length of the data array. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>Number of bytes in the byte array to be included.</dd></dl> </li> </ul> <a name="setSize(int)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setSize</h4> <pre>public void setSize(int size)</pre> <div class="block">Set the byte size of the data array. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>size</code> - Number of bytes in the byte array to be included.</dd></dl> </li> </ul> <a name="getUserBuffer()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getUserBuffer</h4> <pre>public boolean getUserBuffer()</pre> <div class="block">Return true if the whether the buffer in this entry is owned by the application. <p> This method may be called at any time during the life of the application. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>True if the whether the buffer in this entry is owned by the application.</dd></dl> </li> </ul> <a name="getUserBufferLength()"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getUserBufferLength</h4> <pre>public int getUserBufferLength()</pre> <div class="block">Return the length of the application's buffer. <p> This method may be called at any time during the life of the application. <p></div> <dl><dt><span class="strong">Returns:</span></dt><dd>The length of the application's buffer.</dd></dl> </li> </ul> <a name="setUserBuffer(int, boolean)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>setUserBuffer</h4> <pre>public void setUserBuffer(int length, boolean usermem)</pre> <div class="block">Configures the entry with an application-owned buffer. <p> The <code>data</code> field of the entry must refer to a buffer that is at least <code>length</code> bytes in length. <p> If the length of the requested item is less than or equal to that number of bytes, the item is copied into the memory to which the <code>data</code> field refers. Otherwise, the <code>size</code> field is set to the length needed for the requested item, and a <a href="../../../com/sleepycat/db/MemoryException.html" title="class in com.sleepycat.db"><code>MemoryException</code></a> is thrown. <p> Applications can determine the length of a record by setting <code>length</code> to 0 and calling <a href="../../../com/sleepycat/db/DatabaseEntry.html#getSize()"><code>DatabaseEntry.getSize</code></a> on the return value. <p></div> <dl><dt><span class="strong">Parameters:</span></dt><dd><code>length</code> - the length of the buffer <p></dd><dd><code>usermem</code> - whether the buffer is owned by the application</dd></dl> </li> </ul> <a name="equals(java.lang.Object)"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>equals</h4> <pre>public boolean equals(java.lang.Object o)</pre> <div class="block">Compares the data of two entries for byte-by-byte equality. <p>In either entry, if the offset is non-zero or the size is not equal to the data array length, then only the data bounded by these values is compared. The data array length and offset need not be the same in both entries for them to be considered equal.</p> <p>If the data array is null in one entry, then to be considered equal both entries must have a null data array.</p> <p>If the partial property is set in either entry, then to be considered equal both entries must have the same partial properties: partial, partialOffset and partialLength.</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code>equals</code> in class <code>java.lang.Object</code></dd> </dl> </li> </ul> <a name="hashCode()"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>hashCode</h4> <pre>public int hashCode()</pre> <div class="block">Returns a hash code based on the data value.</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code>hashCode</code> in class <code>java.lang.Object</code></dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/DatabaseEntry.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"><em><b>Berkeley DB</b><br><font size="-1"> version 6.1.29</font></em></div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db"><span class="strong">Prev Class</span></a></li> <li><a href="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?com/sleepycat/db/DatabaseEntry.html" target="_top">Frames</a></li> <li><a href="DatabaseEntry.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All 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> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li>Field | </li> <li><a href="#constructor_summary">Constr</a> | </li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li>Field | </li> <li><a href="#constructor_detail">Constr</a> | </li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><font size=1>Copyright (c) 1996, 2016 Oracle and/or its affiliates. All rights reserved.</font></small></p> </body> </html>