source: proiecte/HadoopJUnit/hadoop-0.20.1/docs/api/org/apache/hadoop/io/file/tfile/Utils.html @ 120

Last change on this file since 120 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 29.9 KB
Line 
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_07) on Tue Sep 01 20:56:54 UTC 2009 -->
6<TITLE>
7Utils (Hadoop 0.20.1 API)
8</TITLE>
9
10<META NAME="date" CONTENT="2009-09-01">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.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="Utils (Hadoop 0.20.1 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>&nbsp;</TD>
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Utils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
48  </TR>
49</TABLE>
50</TD>
51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
52</EM>
53</TD>
54</TR>
55
56<TR>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58&nbsp;<A HREF="../../../../../../org/apache/hadoop/io/file/tfile/TFile.Writer.html" title="class in org.apache.hadoop.io.file.tfile"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.Version.html" title="class in org.apache.hadoop.io.file.tfile"><B>NEXT CLASS</B></A></FONT></TD>
60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61  <A HREF="../../../../../../index.html?org/apache/hadoop/io/file/tfile/Utils.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="Utils.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
63&nbsp;<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:&nbsp;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
81DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<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">
91org.apache.hadoop.io.file.tfile</FONT>
92<BR>
93Class Utils</H2>
94<PRE>
95<A HREF="http://java.sun.com/javase/6/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>org.apache.hadoop.io.file.tfile.Utils</B>
97</PRE>
98<HR>
99<DL>
100<DT><PRE>public final class <B>Utils</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
101</PRE>
102
103<P>
104Supporting Utility classes used by TFile, and shared by users of TFile.
105<P>
106
107<P>
108<HR>
109
110<P>
111<!-- ======== NESTED CLASS SUMMARY ======== -->
112
113<A NAME="nested_class_summary"><!-- --></A>
114<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
115<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
116<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
117<B>Nested Class Summary</B></FONT></TH>
118</TR>
119<TR BGCOLOR="white" CLASS="TableRowColor">
120<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
121<CODE>static&nbsp;class</CODE></FONT></TD>
122<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.Version.html" title="class in org.apache.hadoop.io.file.tfile">Utils.Version</A></B></CODE>
123
124<BR>
125&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A generic Version class.</TD>
126</TR>
127</TABLE>
128&nbsp;
129<!-- ========== METHOD SUMMARY =========== -->
130
131<A NAME="method_summary"><!-- --></A>
132<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
133<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
134<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
135<B>Method Summary</B></FONT></TH>
136</TR>
137<TR BGCOLOR="white" CLASS="TableRowColor">
138<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
139<CODE>static
140<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
141<TR ALIGN="right" VALIGN="">
142<TD NOWRAP><FONT SIZE="-1">
143<CODE>&lt;T&gt; int</CODE></FONT></TD>
144</TR>
145</TABLE>
146</CODE></FONT></TD>
147<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#lowerBound(java.util.List, T)">lowerBound</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>&lt;? super T&gt;&gt;&nbsp;list,
148           T&nbsp;key)</CODE>
149
150<BR>
151&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lower bound binary search.</TD>
152</TR>
153<TR BGCOLOR="white" CLASS="TableRowColor">
154<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
155<CODE>static
156<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
157<TR ALIGN="right" VALIGN="">
158<TD NOWRAP><FONT SIZE="-1">
159<CODE>&lt;T&gt; int</CODE></FONT></TD>
160</TR>
161</TABLE>
162</CODE></FONT></TD>
163<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#lowerBound(java.util.List, T, java.util.Comparator)">lowerBound</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends T&gt;&nbsp;list,
164           T&nbsp;key,
165           <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A>&lt;? super T&gt;&nbsp;cmp)</CODE>
166
167<BR>
168&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Lower bound binary search.</TD>
169</TR>
170<TR BGCOLOR="white" CLASS="TableRowColor">
171<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
172<CODE>static&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
173<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#readString(java.io.DataInput)">readString</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</A>&nbsp;in)</CODE>
174
175<BR>
176&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Read a String as a VInt n, followed by n Bytes in Text format.</TD>
177</TR>
178<TR BGCOLOR="white" CLASS="TableRowColor">
179<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
180<CODE>static&nbsp;int</CODE></FONT></TD>
181<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#readVInt(java.io.DataInput)">readVInt</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</A>&nbsp;in)</CODE>
182
183<BR>
184&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Decoding the variable-length integer.</TD>
185</TR>
186<TR BGCOLOR="white" CLASS="TableRowColor">
187<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
188<CODE>static&nbsp;long</CODE></FONT></TD>
189<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#readVLong(java.io.DataInput)">readVLong</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</A>&nbsp;in)</CODE>
190
191<BR>
192&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Decoding the variable-length integer.</TD>
193</TR>
194<TR BGCOLOR="white" CLASS="TableRowColor">
195<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
196<CODE>static
197<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
198<TR ALIGN="right" VALIGN="">
199<TD NOWRAP><FONT SIZE="-1">
200<CODE>&lt;T&gt; int</CODE></FONT></TD>
201</TR>
202</TABLE>
203</CODE></FONT></TD>
204<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#upperBound(java.util.List, T)">upperBound</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>&lt;? super T&gt;&gt;&nbsp;list,
205           T&nbsp;key)</CODE>
206
207<BR>
208&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Upper bound binary search.</TD>
209</TR>
210<TR BGCOLOR="white" CLASS="TableRowColor">
211<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
212<CODE>static
213<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
214<TR ALIGN="right" VALIGN="">
215<TD NOWRAP><FONT SIZE="-1">
216<CODE>&lt;T&gt; int</CODE></FONT></TD>
217</TR>
218</TABLE>
219</CODE></FONT></TD>
220<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#upperBound(java.util.List, T, java.util.Comparator)">upperBound</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends T&gt;&nbsp;list,
221           T&nbsp;key,
222           <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A>&lt;? super T&gt;&nbsp;cmp)</CODE>
223
224<BR>
225&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Upper bound binary search.</TD>
226</TR>
227<TR BGCOLOR="white" CLASS="TableRowColor">
228<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
229<CODE>static&nbsp;void</CODE></FONT></TD>
230<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#writeString(java.io.DataOutput, java.lang.String)">writeString</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</A>&nbsp;out,
231            <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;s)</CODE>
232
233<BR>
234&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Write a String as a VInt n, followed by n Bytes as in Text format.</TD>
235</TR>
236<TR BGCOLOR="white" CLASS="TableRowColor">
237<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
238<CODE>static&nbsp;void</CODE></FONT></TD>
239<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#writeVInt(java.io.DataOutput, int)">writeVInt</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</A>&nbsp;out,
240          int&nbsp;n)</CODE>
241
242<BR>
243&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encoding an integer into a variable-length encoding format.</TD>
244</TR>
245<TR BGCOLOR="white" CLASS="TableRowColor">
246<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
247<CODE>static&nbsp;void</CODE></FONT></TD>
248<TD><CODE><B><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#writeVLong(java.io.DataOutput, long)">writeVLong</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</A>&nbsp;out,
249           long&nbsp;n)</CODE>
250
251<BR>
252&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Encoding a Long integer into a variable-length encoding format.</TD>
253</TR>
254</TABLE>
255&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
256<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
257<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
258<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
259</TR>
260<TR BGCOLOR="white" CLASS="TableRowColor">
261<TD><CODE><A HREF="http://java.sun.com/javase/6/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/javase/6/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/javase/6/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/javase/6/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/javase/6/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/javase/6/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/javase/6/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/javase/6/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/javase/6/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/javase/6/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/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
262</TR>
263</TABLE>
264&nbsp;
265<P>
266
267<!-- ============ METHOD DETAIL ========== -->
268
269<A NAME="method_detail"><!-- --></A>
270<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
271<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
272<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
273<B>Method Detail</B></FONT></TH>
274</TR>
275</TABLE>
276
277<A NAME="writeVInt(java.io.DataOutput, int)"><!-- --></A><H3>
278writeVInt</H3>
279<PRE>
280public static void <B>writeVInt</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</A>&nbsp;out,
281                             int&nbsp;n)
282                      throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
283<DL>
284<DD>Encoding an integer into a variable-length encoding format. Synonymous to
285 <code>Utils#writeVLong(out, n)</code>.
286<P>
287<DD><DL>
288<DT><B>Parameters:</B><DD><CODE>out</CODE> - output stream<DD><CODE>n</CODE> - The integer to be encoded
289<DT><B>Throws:</B>
290<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#writeVLong(java.io.DataOutput, long)"><CODE>writeVLong(DataOutput, long)</CODE></A></DL>
291</DD>
292</DL>
293<HR>
294
295<A NAME="writeVLong(java.io.DataOutput, long)"><!-- --></A><H3>
296writeVLong</H3>
297<PRE>
298public static void <B>writeVLong</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</A>&nbsp;out,
299                              long&nbsp;n)
300                       throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
301<DL>
302<DD>Encoding a Long integer into a variable-length encoding format.
303 <ul>
304 <li>if n in [-32, 127): encode in one byte with the actual value.
305 Otherwise,
306 <li>if n in [-20*2^8, 20*2^8): encode in two bytes: byte[0] = n/256 - 52;
307 byte[1]=n&0xff. Otherwise,
308 <li>if n IN [-16*2^16, 16*2^16): encode in three bytes: byte[0]=n/2^16 -
309 88; byte[1]=(n>>8)&0xff; byte[2]=n&0xff. Otherwise,
310 <li>if n in [-8*2^24, 8*2^24): encode in four bytes: byte[0]=n/2^24 - 112;
311 byte[1] = (n>>16)&0xff; byte[2] = (n>>8)&0xff; byte[3]=n&0xff. Otherwise:
312 <li>if n in [-2^31, 2^31): encode in five bytes: byte[0]=-125; byte[1] =
313 (n>>24)&0xff; byte[2]=(n>>16)&0xff; byte[3]=(n>>8)&0xff; byte[4]=n&0xff;
314 <li>if n in [-2^39, 2^39): encode in six bytes: byte[0]=-124; byte[1] =
315 (n>>32)&0xff; byte[2]=(n>>24)&0xff; byte[3]=(n>>16)&0xff;
316 byte[4]=(n>>8)&0xff; byte[5]=n&0xff
317 <li>if n in [-2^47, 2^47): encode in seven bytes: byte[0]=-123; byte[1] =
318 (n>>40)&0xff; byte[2]=(n>>32)&0xff; byte[3]=(n>>24)&0xff;
319 byte[4]=(n>>16)&0xff; byte[5]=(n>>8)&0xff; byte[6]=n&0xff;
320 <li>if n in [-2^55, 2^55): encode in eight bytes: byte[0]=-122; byte[1] =
321 (n>>48)&0xff; byte[2] = (n>>40)&0xff; byte[3]=(n>>32)&0xff;
322 byte[4]=(n>>24)&0xff; byte[5]=(n>>16)&0xff; byte[6]=(n>>8)&0xff;
323 byte[7]=n&0xff;
324 <li>if n in [-2^63, 2^63): encode in nine bytes: byte[0]=-121; byte[1] =
325 (n>>54)&0xff; byte[2] = (n>>48)&0xff; byte[3] = (n>>40)&0xff;
326 byte[4]=(n>>32)&0xff; byte[5]=(n>>24)&0xff; byte[6]=(n>>16)&0xff;
327 byte[7]=(n>>8)&0xff; byte[8]=n&0xff;
328 </ul>
329<P>
330<DD><DL>
331<DT><B>Parameters:</B><DD><CODE>out</CODE> - output stream<DD><CODE>n</CODE> - the integer number
332<DT><B>Throws:</B>
333<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
334</DD>
335</DL>
336<HR>
337
338<A NAME="readVInt(java.io.DataInput)"><!-- --></A><H3>
339readVInt</H3>
340<PRE>
341public static int <B>readVInt</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</A>&nbsp;in)
342                    throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
343<DL>
344<DD>Decoding the variable-length integer. Synonymous to
345 <code>(int)Utils#readVLong(in)</code>.
346<P>
347<DD><DL>
348<DT><B>Parameters:</B><DD><CODE>in</CODE> - input stream
349<DT><B>Returns:</B><DD>the decoded integer
350<DT><B>Throws:</B>
351<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE><DT><B>See Also:</B><DD><A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.html#readVLong(java.io.DataInput)"><CODE>readVLong(DataInput)</CODE></A></DL>
352</DD>
353</DL>
354<HR>
355
356<A NAME="readVLong(java.io.DataInput)"><!-- --></A><H3>
357readVLong</H3>
358<PRE>
359public static long <B>readVLong</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</A>&nbsp;in)
360                      throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
361<DL>
362<DD>Decoding the variable-length integer. Suppose the value of the first byte
363 is FB, and the following bytes are NB[*].
364 <ul>
365 <li>if (FB >= -32), return (long)FB;
366 <li>if (FB in [-72, -33]), return (FB+52)<<8 + NB[0]&0xff;
367 <li>if (FB in [-104, -73]), return (FB+88)<<16 + (NB[0]&0xff)<<8 +
368 NB[1]&0xff;
369 <li>if (FB in [-120, -105]), return (FB+112)<<24 + (NB[0]&0xff)<<16 +
370 (NB[1]&0xff)<<8 + NB[2]&0xff;
371 <li>if (FB in [-128, -121]), return interpret NB[FB+129] as a signed
372 big-endian integer.
373<P>
374<DD><DL>
375<DT><B>Parameters:</B><DD><CODE>in</CODE> - input stream
376<DT><B>Returns:</B><DD>the decoded long integer.
377<DT><B>Throws:</B>
378<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
379</DD>
380</DL>
381<HR>
382
383<A NAME="writeString(java.io.DataOutput, java.lang.String)"><!-- --></A><H3>
384writeString</H3>
385<PRE>
386public static void <B>writeString</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataOutput.html?is-external=true" title="class or interface in java.io">DataOutput</A>&nbsp;out,
387                               <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;s)
388                        throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
389<DL>
390<DD>Write a String as a VInt n, followed by n Bytes as in Text format.
391<P>
392<DD><DL>
393<DT><B>Parameters:</B><DD><CODE>out</CODE> - <DD><CODE>s</CODE> -
394<DT><B>Throws:</B>
395<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
396</DD>
397</DL>
398<HR>
399
400<A NAME="readString(java.io.DataInput)"><!-- --></A><H3>
401readString</H3>
402<PRE>
403public static <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>readString</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true" title="class or interface in java.io">DataInput</A>&nbsp;in)
404                         throws <A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></PRE>
405<DL>
406<DD>Read a String as a VInt n, followed by n Bytes in Text format.
407<P>
408<DD><DL>
409<DT><B>Parameters:</B><DD><CODE>in</CODE> - The input stream.
410<DT><B>Returns:</B><DD>The string
411<DT><B>Throws:</B>
412<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</A></CODE></DL>
413</DD>
414</DL>
415<HR>
416
417<A NAME="lowerBound(java.util.List,java.lang.Object,java.util.Comparator)"><!-- --></A><A NAME="lowerBound(java.util.List, T, java.util.Comparator)"><!-- --></A><H3>
418lowerBound</H3>
419<PRE>
420public static &lt;T&gt; int <B>lowerBound</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends T&gt;&nbsp;list,
421                                 T&nbsp;key,
422                                 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A>&lt;? super T&gt;&nbsp;cmp)</PRE>
423<DL>
424<DD>Lower bound binary search. Find the index to the first element in the list
425 that compares greater than or equal to key.
426<P>
427<DD><DL>
428<DT><B>Type Parameters:</B><DD><CODE>T</CODE> - Type of the input key.<DT><B>Parameters:</B><DD><CODE>list</CODE> - The list<DD><CODE>key</CODE> - The input key.<DD><CODE>cmp</CODE> - Comparator for the key.
429<DT><B>Returns:</B><DD>The index to the desired element if it exists; or list.size()
430         otherwise.</DL>
431</DD>
432</DL>
433<HR>
434
435<A NAME="upperBound(java.util.List,java.lang.Object,java.util.Comparator)"><!-- --></A><A NAME="upperBound(java.util.List, T, java.util.Comparator)"><!-- --></A><H3>
436upperBound</H3>
437<PRE>
438public static &lt;T&gt; int <B>upperBound</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends T&gt;&nbsp;list,
439                                 T&nbsp;key,
440                                 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Comparator.html?is-external=true" title="class or interface in java.util">Comparator</A>&lt;? super T&gt;&nbsp;cmp)</PRE>
441<DL>
442<DD>Upper bound binary search. Find the index to the first element in the list
443 that compares greater than the input key.
444<P>
445<DD><DL>
446<DT><B>Type Parameters:</B><DD><CODE>T</CODE> - Type of the input key.<DT><B>Parameters:</B><DD><CODE>list</CODE> - The list<DD><CODE>key</CODE> - The input key.<DD><CODE>cmp</CODE> - Comparator for the key.
447<DT><B>Returns:</B><DD>The index to the desired element if it exists; or list.size()
448         otherwise.</DL>
449</DD>
450</DL>
451<HR>
452
453<A NAME="lowerBound(java.util.List,java.lang.Object)"><!-- --></A><A NAME="lowerBound(java.util.List, T)"><!-- --></A><H3>
454lowerBound</H3>
455<PRE>
456public static &lt;T&gt; int <B>lowerBound</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>&lt;? super T&gt;&gt;&nbsp;list,
457                                 T&nbsp;key)</PRE>
458<DL>
459<DD>Lower bound binary search. Find the index to the first element in the list
460 that compares greater than or equal to key.
461<P>
462<DD><DL>
463<DT><B>Type Parameters:</B><DD><CODE>T</CODE> - Type of the input key.<DT><B>Parameters:</B><DD><CODE>list</CODE> - The list<DD><CODE>key</CODE> - The input key.
464<DT><B>Returns:</B><DD>The index to the desired element if it exists; or list.size()
465         otherwise.</DL>
466</DD>
467</DL>
468<HR>
469
470<A NAME="upperBound(java.util.List,java.lang.Object)"><!-- --></A><A NAME="upperBound(java.util.List, T)"><!-- --></A><H3>
471upperBound</H3>
472<PRE>
473public static &lt;T&gt; int <B>upperBound</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true" title="class or interface in java.util">List</A>&lt;? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</A>&lt;? super T&gt;&gt;&nbsp;list,
474                                 T&nbsp;key)</PRE>
475<DL>
476<DD>Upper bound binary search. Find the index to the first element in the list
477 that compares greater than the input key.
478<P>
479<DD><DL>
480<DT><B>Type Parameters:</B><DD><CODE>T</CODE> - Type of the input key.<DT><B>Parameters:</B><DD><CODE>list</CODE> - The list<DD><CODE>key</CODE> - The input key.
481<DT><B>Returns:</B><DD>The index to the desired element if it exists; or list.size()
482         otherwise.</DL>
483</DD>
484</DL>
485<!-- ========= END OF CLASS DATA ========= -->
486<HR>
487
488
489<!-- ======= START OF BOTTOM NAVBAR ====== -->
490<A NAME="navbar_bottom"><!-- --></A>
491<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
492<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
493<TR>
494<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
495<A NAME="navbar_bottom_firstrow"><!-- --></A>
496<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
497  <TR ALIGN="center" VALIGN="top">
498  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
499  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
500  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
501  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Utils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
502  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
503  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
504  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
505  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
506  </TR>
507</TABLE>
508</TD>
509<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
510</EM>
511</TD>
512</TR>
513
514<TR>
515<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
516&nbsp;<A HREF="../../../../../../org/apache/hadoop/io/file/tfile/TFile.Writer.html" title="class in org.apache.hadoop.io.file.tfile"><B>PREV CLASS</B></A>&nbsp;
517&nbsp;<A HREF="../../../../../../org/apache/hadoop/io/file/tfile/Utils.Version.html" title="class in org.apache.hadoop.io.file.tfile"><B>NEXT CLASS</B></A></FONT></TD>
518<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
519  <A HREF="../../../../../../index.html?org/apache/hadoop/io/file/tfile/Utils.html" target="_top"><B>FRAMES</B></A>  &nbsp;
520&nbsp;<A HREF="Utils.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
521&nbsp;<SCRIPT type="text/javascript">
522  <!--
523  if(window==top) {
524    document.writeln('<A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
525  }
526  //-->
527</SCRIPT>
528<NOSCRIPT>
529  <A HREF="../../../../../../allclasses-noframe.html"><B>All Classes</B></A>
530</NOSCRIPT>
531
532
533</FONT></TD>
534</TR>
535<TR>
536<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
537  SUMMARY:&nbsp;<A HREF="#nested_class_summary">NESTED</A>&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
538<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
539DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
540</TR>
541</TABLE>
542<A NAME="skip-navbar_bottom"></A>
543<!-- ======== END OF BOTTOM NAVBAR ======= -->
544
545<HR>
546Copyright &copy; 2009 The Apache Software Foundation
547</BODY>
548</HTML>
Note: See TracBrowser for help on using the repository browser.