1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<!--NewPage--> 3<HTML> 4<HEAD> 5<!-- Generated by javadoc (build 1.6.0_03) on Mon Apr 12 16:25:51 EDT 2010 --> 6<TITLE> 7PackedInteger (Oracle - Berkeley DB Java API) 8</TITLE> 9 10<META NAME="date" CONTENT="2010-04-12"> 11 12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../style.css" TITLE="Style"> 13 14<SCRIPT type="text/javascript"> 15function windowTitle() 16{ 17 if (location.href.indexOf('is-external=true') == -1) { 18 parent.document.title="PackedInteger (Oracle - Berkeley DB Java API)"; 19 } 20} 21</SCRIPT> 22<NOSCRIPT> 23</NOSCRIPT> 24 25</HEAD> 26 27<BODY BGCOLOR="white" onload="windowTitle();"> 28<HR> 29 30 31<!-- ========= START OF TOP NAVBAR ======= --> 32<A NAME="navbar_top"><!-- --></A> 33<A HREF="#skip-navbar_top" title="Skip navigation links"></A> 34<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 35<TR> 36<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 37<A NAME="navbar_top_firstrow"><!-- --></A> 38<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 39 <TR ALIGN="center" VALIGN="top"> 40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/PackedInteger.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 48 </TR> 49</TABLE> 50</TD> 51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 52<b>Berkeley DB</b><br><font size="-1"> version 4.8.30</font></EM> 53</TD> 54</TR> 55 56<TR> 57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 58 <A HREF="../../../com/sleepycat/util/IOExceptionWrapper.html" title="class in com.sleepycat.util"><B>PREV CLASS</B></A> 59 <A HREF="../../../com/sleepycat/util/RuntimeExceptionWrapper.html" title="class in com.sleepycat.util"><B>NEXT CLASS</B></A></FONT></TD> 60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 61 <A HREF="../../../index.html?com/sleepycat/util/PackedInteger.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="PackedInteger.html" target="_top"><B>NO FRAMES</B></A> 63 <SCRIPT type="text/javascript"> 64 <!-- 65 if(window==top) { 66 document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); 67 } 68 //--> 69</SCRIPT> 70<NOSCRIPT> 71 <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> 72</NOSCRIPT> 73 74 75</FONT></TD> 76</TR> 77<TR> 78<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 79 SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 81DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 82</TR> 83</TABLE> 84<A NAME="skip-navbar_top"></A> 85<!-- ========= END OF TOP NAVBAR ========= --> 86 87<HR> 88<!-- ======== START OF CLASS DATA ======== --> 89<H2> 90<FONT SIZE="-1"> 91com.sleepycat.util</FONT> 92<BR> 93Class PackedInteger</H2> 94<PRE> 95<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A> 96 <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.sleepycat.util.PackedInteger</B> 97</PRE> 98<HR> 99<DL> 100<DT><PRE>public class <B>PackedInteger</B><DT>extends <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL> 101</PRE> 102 103<P> 104Static methods for reading and writing packed integers. 105 106 <p>Note that packed integers are not sorted naturally for a byte-by-byte 107 comparison because they have a preceding length and are little endian; 108 therefore, they are typically not used for keys. However, it so happens 109 that packed integers in the range <code>0</code> to <code>630</code> (inclusive) are 110 sorted correctly in a byte-by-byte comparison, and this may be useful for 111 some applications.</p> 112 113 <p>Values in the inclusive range [-119,119] are stored in a single byte. 114 For values outside that range, the first byte stores the sign and the number 115 of additional bytes. The additional bytes store (abs(value) - 119) as an 116 unsigned little endian integer.</p> 117 118 <p>To read and write packed integer values, call <A HREF="../../../com/sleepycat/util/PackedInteger.html#readInt(byte[], int)"><CODE>readInt(byte[], int)</CODE></A> and <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeInt(byte[], int, int)"><CODE>writeInt(byte[], int, int)</CODE></A> or for long values <A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)"><CODE>readLong(byte[], int)</CODE></A> and <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeLong(byte[], int, long)"><CODE>writeLong(byte[], int, long)</CODE></A>. To 119 get the length of a packed integer without reading it, call <A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadIntLength(byte[], int)"><CODE>getReadIntLength(byte[], int)</CODE></A> or <A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadLongLength(byte[], int)"><CODE>getReadLongLength(byte[], int)</CODE></A>. To get the length of an 120 unpacked integer without writing it, call <A HREF="../../../com/sleepycat/util/PackedInteger.html#getWriteIntLength(int)"><CODE>getWriteIntLength(int)</CODE></A> or 121 <A HREF="../../../com/sleepycat/util/PackedInteger.html#getWriteLongLength(long)"><CODE>getWriteLongLength(long)</CODE></A>.</p> 122 123 <p>Because the same packed format is used for int and long values, stored 124 int values may be expanded to long values without introducing a format 125 incompatibility. You can treat previously stored packed int values as long 126 values by calling <A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)"><CODE>readLong(byte[], int)</CODE></A> and <A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadLongLength(byte[], int)"><CODE>getReadLongLength(byte[], int)</CODE></A>.</p> 127<P> 128 129<P> 130<HR> 131 132<P> 133<!-- =========== FIELD SUMMARY =========== --> 134 135<A NAME="field_summary"><!-- --></A> 136<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 137<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 138<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 139<B>Field Summary</B></FONT></TH> 140</TR> 141<TR BGCOLOR="white" CLASS="TableRowColor"> 142<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 143<CODE>static int</CODE></FONT></TD> 144<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#MAX_LENGTH">MAX_LENGTH</A></B></CODE> 145 146<BR> 147 The maximum number of bytes needed to store an int value (5).</TD> 148</TR> 149<TR BGCOLOR="white" CLASS="TableRowColor"> 150<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 151<CODE>static int</CODE></FONT></TD> 152<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#MAX_LONG_LENGTH">MAX_LONG_LENGTH</A></B></CODE> 153 154<BR> 155 The maximum number of bytes needed to store a long value (9).</TD> 156</TR> 157</TABLE> 158 159<!-- ======== CONSTRUCTOR SUMMARY ======== --> 160 161<A NAME="constructor_summary"><!-- --></A> 162<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 163<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 164<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 165<B>Constructor Summary</B></FONT></TH> 166</TR> 167<TR BGCOLOR="white" CLASS="TableRowColor"> 168<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#PackedInteger()">PackedInteger</A></B>()</CODE> 169 170<BR> 171 </TD> 172</TR> 173</TABLE> 174 175<!-- ========== METHOD SUMMARY =========== --> 176 177<A NAME="method_summary"><!-- --></A> 178<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 179<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 180<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 181<B>Method Summary</B></FONT></TH> 182</TR> 183<TR BGCOLOR="white" CLASS="TableRowColor"> 184<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 185<CODE>static int</CODE></FONT></TD> 186<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadIntLength(byte[], int)">getReadIntLength</A></B>(byte[] buf, 187 int off)</CODE> 188 189<BR> 190 Returns the number of bytes that would be read by <A HREF="../../../com/sleepycat/util/PackedInteger.html#readInt(byte[], int)"><CODE>readInt(byte[], int)</CODE></A>.</TD> 191</TR> 192<TR BGCOLOR="white" CLASS="TableRowColor"> 193<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 194<CODE>static int</CODE></FONT></TD> 195<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#getReadLongLength(byte[], int)">getReadLongLength</A></B>(byte[] buf, 196 int off)</CODE> 197 198<BR> 199 Returns the number of bytes that would be read by <A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)"><CODE>readLong(byte[], int)</CODE></A>.</TD> 200</TR> 201<TR BGCOLOR="white" CLASS="TableRowColor"> 202<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 203<CODE>static int</CODE></FONT></TD> 204<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#getWriteIntLength(int)">getWriteIntLength</A></B>(int value)</CODE> 205 206<BR> 207 Returns the number of bytes that would be written by <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeInt(byte[], int, int)"><CODE>writeInt(byte[], int, int)</CODE></A>.</TD> 208</TR> 209<TR BGCOLOR="white" CLASS="TableRowColor"> 210<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 211<CODE>static int</CODE></FONT></TD> 212<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#getWriteLongLength(long)">getWriteLongLength</A></B>(long value)</CODE> 213 214<BR> 215 Returns the number of bytes that would be written by <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeLong(byte[], int, long)"><CODE>writeLong(byte[], int, long)</CODE></A>.</TD> 216</TR> 217<TR BGCOLOR="white" CLASS="TableRowColor"> 218<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 219<CODE>static int</CODE></FONT></TD> 220<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#readInt(byte[], int)">readInt</A></B>(byte[] buf, 221 int off)</CODE> 222 223<BR> 224 Reads a packed integer at the given buffer offset and returns it.</TD> 225</TR> 226<TR BGCOLOR="white" CLASS="TableRowColor"> 227<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 228<CODE>static long</CODE></FONT></TD> 229<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)">readLong</A></B>(byte[] buf, 230 int off)</CODE> 231 232<BR> 233 Reads a packed long integer at the given buffer offset and returns it.</TD> 234</TR> 235<TR BGCOLOR="white" CLASS="TableRowColor"> 236<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 237<CODE>static int</CODE></FONT></TD> 238<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#writeInt(byte[], int, int)">writeInt</A></B>(byte[] buf, 239 int offset, 240 int value)</CODE> 241 242<BR> 243 Writes a packed integer starting at the given buffer offset and returns 244 the next offset to be written.</TD> 245</TR> 246<TR BGCOLOR="white" CLASS="TableRowColor"> 247<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 248<CODE>static int</CODE></FONT></TD> 249<TD><CODE><B><A HREF="../../../com/sleepycat/util/PackedInteger.html#writeLong(byte[], int, long)">writeLong</A></B>(byte[] buf, 250 int offset, 251 long value)</CODE> 252 253<BR> 254 Writes a packed long integer starting at the given buffer offset and 255 returns the next offset to be written.</TD> 256</TR> 257</TABLE> 258 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 259<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 260<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 261<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH> 262</TR> 263<TR BGCOLOR="white" CLASS="TableRowColor"> 264<TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> 265</TR> 266</TABLE> 267 268<P> 269 270<!-- ============ FIELD DETAIL =========== --> 271 272<A NAME="field_detail"><!-- --></A> 273<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 274<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 275<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 276<B>Field Detail</B></FONT></TH> 277</TR> 278</TABLE> 279 280<A NAME="MAX_LENGTH"><!-- --></A><H3> 281MAX_LENGTH</H3> 282<PRE> 283public static final int <B>MAX_LENGTH</B></PRE> 284<DL> 285<DD>The maximum number of bytes needed to store an int value (5). 286<P> 287<DL> 288<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#com.sleepycat.util.PackedInteger.MAX_LENGTH">Constant Field Values</A></DL> 289</DL> 290<HR> 291 292<A NAME="MAX_LONG_LENGTH"><!-- --></A><H3> 293MAX_LONG_LENGTH</H3> 294<PRE> 295public static final int <B>MAX_LONG_LENGTH</B></PRE> 296<DL> 297<DD>The maximum number of bytes needed to store a long value (9). 298<P> 299<DL> 300<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#com.sleepycat.util.PackedInteger.MAX_LONG_LENGTH">Constant Field Values</A></DL> 301</DL> 302 303<!-- ========= CONSTRUCTOR DETAIL ======== --> 304 305<A NAME="constructor_detail"><!-- --></A> 306<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 307<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 308<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 309<B>Constructor Detail</B></FONT></TH> 310</TR> 311</TABLE> 312 313<A NAME="PackedInteger()"><!-- --></A><H3> 314PackedInteger</H3> 315<PRE> 316public <B>PackedInteger</B>()</PRE> 317<DL> 318</DL> 319 320<!-- ============ METHOD DETAIL ========== --> 321 322<A NAME="method_detail"><!-- --></A> 323<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 324<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 325<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 326<B>Method Detail</B></FONT></TH> 327</TR> 328</TABLE> 329 330<A NAME="readInt(byte[], int)"><!-- --></A><H3> 331readInt</H3> 332<PRE> 333public static int <B>readInt</B>(byte[] buf, 334 int off)</PRE> 335<DL> 336<DD>Reads a packed integer at the given buffer offset and returns it. 337<P> 338<DD><DL> 339<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to read from.<DD><CODE>off</CODE> - the offset in the buffer at which to start reading. 340<DT><B>Returns:</B><DD>the integer that was read.</DL> 341</DD> 342</DL> 343<HR> 344 345<A NAME="readLong(byte[], int)"><!-- --></A><H3> 346readLong</H3> 347<PRE> 348public static long <B>readLong</B>(byte[] buf, 349 int off)</PRE> 350<DL> 351<DD>Reads a packed long integer at the given buffer offset and returns it. 352<P> 353<DD><DL> 354<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to read from.<DD><CODE>off</CODE> - the offset in the buffer at which to start reading. 355<DT><B>Returns:</B><DD>the long integer that was read.</DL> 356</DD> 357</DL> 358<HR> 359 360<A NAME="getReadIntLength(byte[], int)"><!-- --></A><H3> 361getReadIntLength</H3> 362<PRE> 363public static int <B>getReadIntLength</B>(byte[] buf, 364 int off)</PRE> 365<DL> 366<DD>Returns the number of bytes that would be read by <A HREF="../../../com/sleepycat/util/PackedInteger.html#readInt(byte[], int)"><CODE>readInt(byte[], int)</CODE></A>. 367 368 <p>Because the length is stored in the first byte, this method may be 369 called with only the first byte of the packed integer in the given 370 buffer. This method only accesses one byte at the given offset.</p> 371<P> 372<DD><DL> 373<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to read from.<DD><CODE>off</CODE> - the offset in the buffer at which to start reading. 374<DT><B>Returns:</B><DD>the number of bytes that would be read.</DL> 375</DD> 376</DL> 377<HR> 378 379<A NAME="getReadLongLength(byte[], int)"><!-- --></A><H3> 380getReadLongLength</H3> 381<PRE> 382public static int <B>getReadLongLength</B>(byte[] buf, 383 int off)</PRE> 384<DL> 385<DD>Returns the number of bytes that would be read by <A HREF="../../../com/sleepycat/util/PackedInteger.html#readLong(byte[], int)"><CODE>readLong(byte[], int)</CODE></A>. 386 387 <p>Because the length is stored in the first byte, this method may be 388 called with only the first byte of the packed integer in the given 389 buffer. This method only accesses one byte at the given offset.</p> 390<P> 391<DD><DL> 392<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to read from.<DD><CODE>off</CODE> - the offset in the buffer at which to start reading. 393<DT><B>Returns:</B><DD>the number of bytes that would be read.</DL> 394</DD> 395</DL> 396<HR> 397 398<A NAME="writeInt(byte[], int, int)"><!-- --></A><H3> 399writeInt</H3> 400<PRE> 401public static int <B>writeInt</B>(byte[] buf, 402 int offset, 403 int value)</PRE> 404<DL> 405<DD>Writes a packed integer starting at the given buffer offset and returns 406 the next offset to be written. 407<P> 408<DD><DL> 409<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to write to.<DD><CODE>offset</CODE> - the offset in the buffer at which to start writing.<DD><CODE>value</CODE> - the integer to be written. 410<DT><B>Returns:</B><DD>the offset past the bytes written.</DL> 411</DD> 412</DL> 413<HR> 414 415<A NAME="writeLong(byte[], int, long)"><!-- --></A><H3> 416writeLong</H3> 417<PRE> 418public static int <B>writeLong</B>(byte[] buf, 419 int offset, 420 long value)</PRE> 421<DL> 422<DD>Writes a packed long integer starting at the given buffer offset and 423 returns the next offset to be written. 424<P> 425<DD><DL> 426<DT><B>Parameters:</B><DD><CODE>buf</CODE> - the buffer to write to.<DD><CODE>offset</CODE> - the offset in the buffer at which to start writing.<DD><CODE>value</CODE> - the long integer to be written. 427<DT><B>Returns:</B><DD>the offset past the bytes written.</DL> 428</DD> 429</DL> 430<HR> 431 432<A NAME="getWriteIntLength(int)"><!-- --></A><H3> 433getWriteIntLength</H3> 434<PRE> 435public static int <B>getWriteIntLength</B>(int value)</PRE> 436<DL> 437<DD>Returns the number of bytes that would be written by <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeInt(byte[], int, int)"><CODE>writeInt(byte[], int, int)</CODE></A>. 438<P> 439<DD><DL> 440<DT><B>Parameters:</B><DD><CODE>value</CODE> - the integer to be written. 441<DT><B>Returns:</B><DD>the number of bytes that would be used to write the given 442 integer.</DL> 443</DD> 444</DL> 445<HR> 446 447<A NAME="getWriteLongLength(long)"><!-- --></A><H3> 448getWriteLongLength</H3> 449<PRE> 450public static int <B>getWriteLongLength</B>(long value)</PRE> 451<DL> 452<DD>Returns the number of bytes that would be written by <A HREF="../../../com/sleepycat/util/PackedInteger.html#writeLong(byte[], int, long)"><CODE>writeLong(byte[], int, long)</CODE></A>. 453<P> 454<DD><DL> 455<DT><B>Parameters:</B><DD><CODE>value</CODE> - the long integer to be written. 456<DT><B>Returns:</B><DD>the number of bytes that would be used to write the given long 457 integer.</DL> 458</DD> 459</DL> 460<!-- ========= END OF CLASS DATA ========= --> 461<HR> 462 463 464<!-- ======= START OF BOTTOM NAVBAR ====== --> 465<A NAME="navbar_bottom"><!-- --></A> 466<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 467<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 468<TR> 469<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 470<A NAME="navbar_bottom_firstrow"><!-- --></A> 471<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 472 <TR ALIGN="center" VALIGN="top"> 473 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 474 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 475 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 476 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/PackedInteger.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 477 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 478 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 479 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 480 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 481 </TR> 482</TABLE> 483</TD> 484<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 485<b>Berkeley DB</b><br><font size="-1"> version 4.8.30</font></EM> 486</TD> 487</TR> 488 489<TR> 490<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 491 <A HREF="../../../com/sleepycat/util/IOExceptionWrapper.html" title="class in com.sleepycat.util"><B>PREV CLASS</B></A> 492 <A HREF="../../../com/sleepycat/util/RuntimeExceptionWrapper.html" title="class in com.sleepycat.util"><B>NEXT CLASS</B></A></FONT></TD> 493<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 494 <A HREF="../../../index.html?com/sleepycat/util/PackedInteger.html" target="_top"><B>FRAMES</B></A> 495 <A HREF="PackedInteger.html" target="_top"><B>NO FRAMES</B></A> 496 <SCRIPT type="text/javascript"> 497 <!-- 498 if(window==top) { 499 document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>'); 500 } 501 //--> 502</SCRIPT> 503<NOSCRIPT> 504 <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A> 505</NOSCRIPT> 506 507 508</FONT></TD> 509</TR> 510<TR> 511<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 512 SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 513<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 514DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 515</TR> 516</TABLE> 517<A NAME="skip-navbar_bottom"></A> 518<!-- ======== END OF BOTTOM NAVBAR ======= --> 519 520<HR> 521<font size=1>Copyright (c) 1996-2009 Oracle. All rights reserved.</font> 522</BODY> 523</HTML> 524