<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_0) on Wed Dec 30 04:50:31 EST 2009 --> <TITLE> DatabaseEntry </TITLE> <META NAME="date" CONTENT="2009-12-30"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="DatabaseEntry"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/db/DatabaseEntry.html" target="_top"><B>FRAMES</B></A> <A HREF="DatabaseEntry.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> com.sleepycat.db</FONT> <BR> Class DatabaseEntry</H2> <PRE> java.lang.Object <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.db.DatabaseEntry</B> </PRE> <DL> <DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../com/sleepycat/db/MultipleEntry.html" title="class in com.sleepycat.db">MultipleEntry</A></DD> </DL> <HR> <DL> <DT><PRE>public class <B>DatabaseEntry</B><DT>extends java.lang.Object</DL> </PRE> <P> 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 <CODE>com.sleepycat.bind</CODE> 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, com.sleepycat.db.DatabaseEntry, com.sleepycat.db.DatabaseEntry, com.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, boolean)"><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, int, boolean)"><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. <P> <P> <HR> <P> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <A NAME="constructor_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#DatabaseEntry()">DatabaseEntry</A></B>()</CODE> <BR> Construct a DatabaseEntry with null data.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#DatabaseEntry(byte[])">DatabaseEntry</A></B>(byte[] data)</CODE> <BR> Construct a DatabaseEntry with a given byte array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#DatabaseEntry(byte[], int, int)">DatabaseEntry</A></B>(byte[] data, int offset, int size)</CODE> <BR> Constructs a DatabaseEntry with a given byte array, offset and size.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#DatabaseEntry(java.nio.ByteBuffer)">DatabaseEntry</A></B>(java.nio.ByteBuffer data)</CODE> <BR> Construct a DatabaseEntry with a given native I/O buffer.</TD> </TR> </TABLE> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#equals(java.lang.Object)">equals</A></B>(java.lang.Object o)</CODE> <BR> Compares the data of two entries for byte-by-byte equality.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getData()">getData</A></B>()</CODE> <BR> Return the byte array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> java.nio.ByteBuffer</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getDataNIO()">getDataNIO</A></B>()</CODE> <BR> Return the java.nio.ByteBuffer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getOffset()">getOffset</A></B>()</CODE> <BR> Return the byte offset into the data array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getPartial()">getPartial</A></B>()</CODE> <BR> Return whether this DatabaseEntry is configured to read or write partial records.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getPartialLength()">getPartialLength</A></B>()</CODE> <BR> Return the byte length of the partial record being read or written by the application, in bytes.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getPartialOffset()">getPartialOffset</A></B>()</CODE> <BR> Return the offset of the partial record being read or written by the application, in bytes.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getRecordNumber()">getRecordNumber</A></B>()</CODE> <BR> Return the record number encoded in this entry's buffer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getReuseBuffer()">getReuseBuffer</A></B>()</CODE> <BR> Return true if the whether the entry is configured to reuse the buffer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getSize()">getSize</A></B>()</CODE> <BR> Return the byte size of the data array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> boolean</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getUserBuffer()">getUserBuffer</A></B>()</CODE> <BR> Return true if the whether the buffer in this entry is owned by the application.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#getUserBufferLength()">getUserBufferLength</A></B>()</CODE> <BR> Return the length of the application's buffer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> int</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#hashCode()">hashCode</A></B>()</CODE> <BR> Returns a hash code based on the data value.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setData(byte[])">setData</A></B>(byte[] data)</CODE> <BR> Sets the byte array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setData(byte[], int, int)">setData</A></B>(byte[] data, int offset, int size)</CODE> <BR> Sets the byte array, offset and size.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setDataNIO(java.nio.ByteBuffer)">setDataNIO</A></B>(java.nio.ByteBuffer data)</CODE> <BR> Sets the java.nio.ByteBuffer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setDataNIO(java.nio.ByteBuffer, int, int)">setDataNIO</A></B>(java.nio.ByteBuffer data, int offset, int size)</CODE> <BR> Sets the java.nio.ByteBuffer.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setOffset(int)">setOffset</A></B>(int offset)</CODE> <BR> Set the byte offset into the data array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(boolean)">setPartial</A></B>(boolean partial)</CODE> <BR> Configure this DatabaseEntry to read or write partial records.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int, int, boolean)">setPartial</A></B>(int doff, int dlen, boolean partial)</CODE> <BR> Configures this DatabaseEntry to read or write partial records.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartialLength(int)">setPartialLength</A></B>(int dlen)</CODE> <BR> Set the byte length of the partial record being read or written by the application, in bytes.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartialOffset(int)">setPartialOffset</A></B>(int doff)</CODE> <BR> Set the offset of the partial record being read or written by the application, in bytes.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setRecordNumber(int)">setRecordNumber</A></B>(int recno)</CODE> <BR> Initialize the entry from a logical record number.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setReuseBuffer(boolean)">setReuseBuffer</A></B>(boolean reuse)</CODE> <BR> Configures the entry to try to reuse the buffer before allocating a new one.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setSize(int)">setSize</A></B>(int size)</CODE> <BR> Set the byte size of the data array.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE> void</CODE></FONT></TD> <TD><CODE><B><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setUserBuffer(int, boolean)">setUserBuffer</A></B>(int length, boolean usermem)</CODE> <BR> Configures the entry with an application-owned buffer.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait</CODE></TD> </TR> </TABLE> <P> <!-- ========= CONSTRUCTOR DETAIL ======== --> <A NAME="constructor_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="DatabaseEntry()"><!-- --></A><H3> DatabaseEntry</H3> <PRE> public <B>DatabaseEntry</B>()</PRE> <DL> <DD>Construct a DatabaseEntry with null data. The offset and size are set to zero. <P> </DL> <HR> <A NAME="DatabaseEntry(byte[])"><!-- --></A><H3> DatabaseEntry</H3> <PRE> public <B>DatabaseEntry</B>(byte[] data)</PRE> <DL> <DD>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> <P> <DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - Byte array wrapped by the DatabaseEntry.</DL> </DL> <HR> <A NAME="DatabaseEntry(byte[], int, int)"><!-- --></A><H3> DatabaseEntry</H3> <PRE> public <B>DatabaseEntry</B>(byte[] data, int offset, int size)</PRE> <DL> <DD>Constructs a DatabaseEntry with a given byte array, offset and size. <p> <P> <DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - Byte array wrapped by the DatabaseEntry.<DD><CODE>offset</CODE> - Offset in the first byte in the byte array to be included.<DD><CODE>size</CODE> - Number of bytes in the byte array to be included.</DL> </DL> <HR> <A NAME="DatabaseEntry(java.nio.ByteBuffer)"><!-- --></A><H3> DatabaseEntry</H3> <PRE> public <B>DatabaseEntry</B>(java.nio.ByteBuffer data)</PRE> <DL> <DD>Construct a DatabaseEntry with a given native I/O buffer. <p> <P> <DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - NIO byte buffer wrapped by the DatabaseEntry.</DL> </DL> <!-- ============ METHOD DETAIL ========== --> <A NAME="method_detail"><!-- --></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Method Detail</B></FONT></TH> </TR> </TABLE> <A NAME="getData()"><!-- --></A><H3> getData</H3> <PRE> public byte[] <B>getData</B>()</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Returns:</B><DD>The byte array.</DL> </DD> </DL> <HR> <A NAME="getDataNIO()"><!-- --></A><H3> getDataNIO</H3> <PRE> public java.nio.ByteBuffer <B>getDataNIO</B>()</PRE> <DL> <DD>Return the java.nio.ByteBuffer. <p> Used to access the underlying data when the DatabaseEntry is configured to utilize a java.nio.ByteBuffer. <p> <P> <DD><DL> <DT><B>Returns:</B><DD>The underlying java.nio.ByteBuffer.</DL> </DD> </DL> <HR> <A NAME="setData(byte[], int, int)"><!-- --></A><H3> setData</H3> <PRE> public void <B>setData</B>(byte[] data, int offset, int size)</PRE> <DL> <DD>Sets the byte array, offset and size. <p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - Byte array wrapped by the DatabaseEntry.<DD><CODE>offset</CODE> - Offset in the first byte in the byte array to be included.<DD><CODE>size</CODE> - Number of bytes in the byte array to be included.</DL> </DD> </DL> <HR> <A NAME="setData(byte[])"><!-- --></A><H3> setData</H3> <PRE> public void <B>setData</B>(byte[] data)</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - Byte array wrapped by the DatabaseEntry.</DL> </DD> </DL> <HR> <A NAME="setDataNIO(java.nio.ByteBuffer, int, int)"><!-- --></A><H3> setDataNIO</H3> <PRE> public void <B>setDataNIO</B>(java.nio.ByteBuffer data, int offset, int size)</PRE> <DL> <DD>Sets the java.nio.ByteBuffer. The offset is set to zero; the size is set to the length of the ByteBuffer, or to zero if null is passed. <p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - java.nio.ByteBuffer wrapped by the DatabaseEntry.<DD><CODE>offset</CODE> - int offset into the ByteBuffer where the DatabaseEntry data begins.<DD><CODE>size</CODE> - int size of the ByteBuffer available.</DL> </DD> </DL> <HR> <A NAME="setDataNIO(java.nio.ByteBuffer)"><!-- --></A><H3> setDataNIO</H3> <PRE> public void <B>setDataNIO</B>(java.nio.ByteBuffer data)</PRE> <DL> <DD>Sets the java.nio.ByteBuffer. The offset is set to zero; the size is set to the length of the ByteBuffer, or to zero if null is passed. <p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - java.nio.ByteBuffer wrapped by the DatabaseEntry.</DL> </DD> </DL> <HR> <A NAME="getOffset()"><!-- --></A><H3> getOffset</H3> <PRE> public int <B>getOffset</B>()</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Returns:</B><DD>Offset in the first byte in the byte array to be included.</DL> </DD> </DL> <HR> <A NAME="setOffset(int)"><!-- --></A><H3> setOffset</H3> <PRE> public void <B>setOffset</B>(int offset)</PRE> <DL> <DD>Set the byte offset into the data array. <p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>offset</CODE> - Offset in the first byte in the byte array to be included.</DL> </DD> </DL> <HR> <A NAME="getPartialLength()"><!-- --></A><H3> getPartialLength</H3> <PRE> public int <B>getPartialLength</B>()</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Returns:</B><DD>The byte length of the partial record being read or written by the application, in bytes. <p><DT><B>See Also:</B><DD><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int, int, boolean)"><CODE>setPartial(int,int,boolean)</CODE></A></DL> </DD> </DL> <HR> <A NAME="getPartialOffset()"><!-- --></A><H3> getPartialOffset</H3> <PRE> public int <B>getPartialOffset</B>()</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Returns:</B><DD>The offset of the partial record being read or written by the application, in bytes. <p><DT><B>See Also:</B><DD><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int, int, boolean)"><CODE>setPartial(int,int,boolean)</CODE></A></DL> </DD> </DL> <HR> <A NAME="getPartial()"><!-- --></A><H3> getPartial</H3> <PRE> public boolean <B>getPartial</B>()</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Returns:</B><DD>Whether this DatabaseEntry is configured to read or write partial records. <p><DT><B>See Also:</B><DD><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int, int, boolean)"><CODE>setPartial(int,int,boolean)</CODE></A></DL> </DD> </DL> <HR> <A NAME="setPartialOffset(int)"><!-- --></A><H3> setPartialOffset</H3> <PRE> public void <B>setPartialOffset</B>(int doff)</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>doff</CODE> - The offset of the partial record being read or written by the application, in bytes. <p><DT><B>See Also:</B><DD><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int, int, boolean)"><CODE>setPartial(int,int,boolean)</CODE></A></DL> </DD> </DL> <HR> <A NAME="setPartialLength(int)"><!-- --></A><H3> setPartialLength</H3> <PRE> public void <B>setPartialLength</B>(int dlen)</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>dlen</CODE> - The byte length of the partial record being read or written by the <p><DT><B>See Also:</B><DD><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int, int, boolean)"><CODE>application, in bytes.</CODE></A></DL> </DD> </DL> <HR> <A NAME="setPartial(boolean)"><!-- --></A><H3> setPartial</H3> <PRE> public void <B>setPartial</B>(boolean partial)</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>partial</CODE> - Whether this DatabaseEntry is configured to read or write partial records. <p><DT><B>See Also:</B><DD><A HREF="../../../com/sleepycat/db/DatabaseEntry.html#setPartial(int, int, boolean)"><CODE>setPartial(int,int,boolean)</CODE></A></DL> </DD> </DL> <HR> <A NAME="setPartial(int, int, boolean)"><!-- --></A><H3> setPartial</H3> <PRE> public void <B>setPartial</B>(int doff, int dlen, boolean partial)</PRE> <DL> <DD>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, com.sleepycat.db.DatabaseEntry, com.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> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>doff</CODE> - The offset of the partial record being read or written by the application, in bytes. <p><DD><CODE>dlen</CODE> - The byte length of the partial record being read or written by the application, in bytes. <p><DD><CODE>partial</CODE> - Whether this DatabaseEntry is configured to read or write partial records.</DL> </DD> </DL> <HR> <A NAME="getRecordNumber()"><!-- --></A><H3> getRecordNumber</H3> <PRE> public int <B>getRecordNumber</B>()</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Returns:</B><DD>The record number encoded in this entry's buffer.</DL> </DD> </DL> <HR> <A NAME="setRecordNumber(int)"><!-- --></A><H3> setRecordNumber</H3> <PRE> public void <B>setRecordNumber</B>(int recno)</PRE> <DL> <DD>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. <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>recno</CODE> - the record number to be encoded</DL> </DD> </DL> <HR> <A NAME="getReuseBuffer()"><!-- --></A><H3> getReuseBuffer</H3> <PRE> public boolean <B>getReuseBuffer</B>()</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Returns:</B><DD>True if the whether the entry is configured to reuse the buffer.</DL> </DD> </DL> <HR> <A NAME="setReuseBuffer(boolean)"><!-- --></A><H3> setReuseBuffer</H3> <PRE> public void <B>setReuseBuffer</B>(boolean reuse)</PRE> <DL> <DD>Configures the entry to try to reuse the buffer before allocating a new one. <p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>reuse</CODE> - whether to reuse the buffer</DL> </DD> </DL> <HR> <A NAME="getSize()"><!-- --></A><H3> getSize</H3> <PRE> public int <B>getSize</B>()</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Returns:</B><DD>Number of bytes in the byte array to be included.</DL> </DD> </DL> <HR> <A NAME="setSize(int)"><!-- --></A><H3> setSize</H3> <PRE> public void <B>setSize</B>(int size)</PRE> <DL> <DD>Set the byte size of the data array. <p> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>size</CODE> - Number of bytes in the byte array to be included.</DL> </DD> </DL> <HR> <A NAME="getUserBuffer()"><!-- --></A><H3> getUserBuffer</H3> <PRE> public boolean <B>getUserBuffer</B>()</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Returns:</B><DD>True if the whether the buffer in this entry is owned by the application.</DL> </DD> </DL> <HR> <A NAME="getUserBufferLength()"><!-- --></A><H3> getUserBufferLength</H3> <PRE> public int <B>getUserBufferLength</B>()</PRE> <DL> <DD>Return the length of the application's buffer. <p> This method may be called at any time during the life of the application. <p> <P> <DD><DL> <DT><B>Returns:</B><DD>The length of the application's buffer.</DL> </DD> </DL> <HR> <A NAME="setUserBuffer(int, boolean)"><!-- --></A><H3> setUserBuffer</H3> <PRE> public void <B>setUserBuffer</B>(int length, boolean usermem)</PRE> <DL> <DD>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> <P> <DD><DL> <DT><B>Parameters:</B><DD><CODE>length</CODE> - the length of the buffer <p><DD><CODE>usermem</CODE> - whether the buffer is owned by the application</DL> </DD> </DL> <HR> <A NAME="equals(java.lang.Object)"><!-- --></A><H3> equals</H3> <PRE> public boolean <B>equals</B>(java.lang.Object o)</PRE> <DL> <DD>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. <P> <DD><DL> <DT><B>Overrides:</B><DD><CODE>equals</CODE> in class <CODE>java.lang.Object</CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <HR> <A NAME="hashCode()"><!-- --></A><H3> hashCode</H3> <PRE> public int <B>hashCode</B>()</PRE> <DL> <DD>Returns a hash code based on the data value. <P> <DD><DL> <DT><B>Overrides:</B><DD><CODE>hashCode</CODE> in class <CODE>java.lang.Object</CODE></DL> </DD> <DD><DL> </DL> </DD> </DL> <!-- ========= END OF CLASS DATA ========= --> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../com/sleepycat/db/DatabaseConfig.html" title="class in com.sleepycat.db"><B>PREV CLASS</B></A> <A HREF="../../../com/sleepycat/db/DatabaseException.html" title="class in com.sleepycat.db"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html?com/sleepycat/db/DatabaseEntry.html" target="_top"><B>FRAMES</B></A> <A HREF="DatabaseEntry.html" target="_top"><B>NO FRAMES</B></A> <SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <HR> </BODY> </HTML>