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