• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-google-internal) on Mon Jan 04 20:47:59 PST 2010 -->
6<TITLE>
7Bytes (Guava Libraries 2010.01.04)
8</TITLE>
9
10<META NAME="date" CONTENT="2010-01-04">
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="Bytes (Guava Libraries 2010.01.04)";
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/Bytes.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="../../../../com/google/common/primitives/Booleans.html" title="class in com.google.common.primitives"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../com/google/common/primitives/Chars.html" title="class in com.google.common.primitives"><B>NEXT CLASS</B></A></FONT></TD>
60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61  <A HREF="../../../../index.html?com/google/common/primitives/Bytes.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="Bytes.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;NESTED&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">
91com.google.common.primitives</FONT>
92<BR>
93Class Bytes</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>com.google.common.primitives.Bytes</B>
97</PRE>
98<HR>
99<DL>
100<DT><PRE>public final class <B>Bytes</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>
104Static utility methods pertaining to <code>byte</code> primitives, that are not
105 already found in either <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Byte.html?is-external=true" title="class or interface in java.lang"><CODE>Byte</CODE></A> or <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true" title="class or interface in java.util"><CODE>Arrays</CODE></A>, <i>and interpret
106 bytes as neither signed nor unsigned</i>. The methods which specifically
107 treat bytes as signed or unsigned are found in <A HREF="../../../../com/google/common/primitives/SignedBytes.html" title="class in com.google.common.primitives"><CODE>SignedBytes</CODE></A> and <A HREF="../../../../com/google/common/primitives/UnsignedBytes.html" title="class in com.google.common.primitives"><CODE>UnsignedBytes</CODE></A>.
108<P>
109
110<P>
111<DL>
112<DT><B>Since:</B></DT>
113  <DD>2009.09.15 <b>tentative</b></DD>
114<DT><B>Author:</B></DT>
115  <DD>Kevin Bourrillion</DD>
116</DL>
117<HR>
118
119<P>
120
121<!-- ========== METHOD SUMMARY =========== -->
122
123<A NAME="method_summary"><!-- --></A>
124<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
125<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
126<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
127<B>Method Summary</B></FONT></TH>
128</TR>
129<TR BGCOLOR="white" CLASS="TableRowColor">
130<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
131<CODE>static&nbsp;<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;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Byte.html?is-external=true" title="class or interface in java.lang">Byte</A>&gt;</CODE></FONT></TD>
132<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Bytes.html#asList(byte...)">asList</A></B>(byte...&nbsp;backingArray)</CODE>
133
134<BR>
135&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a fixed-size list backed by the specified array, similar to <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#asList(T...)" title="class or interface in java.util"><CODE>Arrays.asList(Object[])</CODE></A>.</TD>
136</TR>
137<TR BGCOLOR="white" CLASS="TableRowColor">
138<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
139<CODE>static&nbsp;byte[]</CODE></FONT></TD>
140<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Bytes.html#concat(byte[]...)">concat</A></B>(byte[]...&nbsp;arrays)</CODE>
141
142<BR>
143&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the values from each provided array combined into a single array.</TD>
144</TR>
145<TR BGCOLOR="white" CLASS="TableRowColor">
146<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
147<CODE>static&nbsp;boolean</CODE></FONT></TD>
148<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Bytes.html#contains(byte[], byte)">contains</A></B>(byte[]&nbsp;array,
149         byte&nbsp;target)</CODE>
150
151<BR>
152&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if <code>target</code> is present as an element anywhere in
153 <code>array</code>.</TD>
154</TR>
155<TR BGCOLOR="white" CLASS="TableRowColor">
156<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
157<CODE>static&nbsp;byte[]</CODE></FONT></TD>
158<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Bytes.html#ensureCapacity(byte[], int, int)">ensureCapacity</A></B>(byte[]&nbsp;array,
159               int&nbsp;minLength,
160               int&nbsp;padding)</CODE>
161
162<BR>
163&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an array containing the same values as <code>array</code>, but
164 guaranteed to be of a specified minimum length.</TD>
165</TR>
166<TR BGCOLOR="white" CLASS="TableRowColor">
167<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
168<CODE>static&nbsp;int</CODE></FONT></TD>
169<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Bytes.html#hashCode(byte)">hashCode</A></B>(byte&nbsp;value)</CODE>
170
171<BR>
172&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a hash code for <code>value</code>; equal to the result of invoking
173 <code>((Byte) value).hashCode()</code>.</TD>
174</TR>
175<TR BGCOLOR="white" CLASS="TableRowColor">
176<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
177<CODE>static&nbsp;int</CODE></FONT></TD>
178<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Bytes.html#indexOf(byte[], byte)">indexOf</A></B>(byte[]&nbsp;array,
179        byte&nbsp;target)</CODE>
180
181<BR>
182&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the index of the first appearance of the value <code>target</code> in
183 <code>array</code>.</TD>
184</TR>
185<TR BGCOLOR="white" CLASS="TableRowColor">
186<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
187<CODE>static&nbsp;int</CODE></FONT></TD>
188<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Bytes.html#indexOf(byte[], byte[])">indexOf</A></B>(byte[]&nbsp;array,
189        byte[]&nbsp;target)</CODE>
190
191<BR>
192&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the start position of the first occurrence of the specified <code>target</code> within <code>array</code>, or <code>-1</code> if there is no such occurrence.</TD>
193</TR>
194<TR BGCOLOR="white" CLASS="TableRowColor">
195<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
196<CODE>static&nbsp;int</CODE></FONT></TD>
197<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Bytes.html#lastIndexOf(byte[], byte)">lastIndexOf</A></B>(byte[]&nbsp;array,
198            byte&nbsp;target)</CODE>
199
200<BR>
201&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the index of the last appearance of the value <code>target</code> in
202 <code>array</code>.</TD>
203</TR>
204<TR BGCOLOR="white" CLASS="TableRowColor">
205<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
206<CODE>static&nbsp;byte[]</CODE></FONT></TD>
207<TD><CODE><B><A HREF="../../../../com/google/common/primitives/Bytes.html#toArray(java.util.Collection)">toArray</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Byte.html?is-external=true" title="class or interface in java.lang">Byte</A>&gt;&nbsp;collection)</CODE>
208
209<BR>
210&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Copies a collection of <code>Byte</code> instances into a new array of
211 primitive <code>byte</code> values.</TD>
212</TR>
213</TABLE>
214&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
215<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
216<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
217<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>
218</TR>
219<TR BGCOLOR="white" CLASS="TableRowColor">
220<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>
221</TR>
222</TABLE>
223&nbsp;
224<P>
225
226<!-- ============ METHOD DETAIL ========== -->
227
228<A NAME="method_detail"><!-- --></A>
229<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
230<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
231<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
232<B>Method Detail</B></FONT></TH>
233</TR>
234</TABLE>
235
236<A NAME="hashCode(byte)"><!-- --></A><H3>
237hashCode</H3>
238<PRE>
239public static int <B>hashCode</B>(byte&nbsp;value)</PRE>
240<DL>
241<DD>Returns a hash code for <code>value</code>; equal to the result of invoking
242 <code>((Byte) value).hashCode()</code>.
243<P>
244<DD><DL>
245<DT><B>Parameters:</B><DD><CODE>value</CODE> - a primitive <code>byte</code> value
246<DT><B>Returns:</B><DD>a hash code for the value</DL>
247</DD>
248</DL>
249<HR>
250
251<A NAME="contains(byte[], byte)"><!-- --></A><H3>
252contains</H3>
253<PRE>
254public static boolean <B>contains</B>(byte[]&nbsp;array,
255                               byte&nbsp;target)</PRE>
256<DL>
257<DD>Returns <code>true</code> if <code>target</code> is present as an element anywhere in
258 <code>array</code>.
259<P>
260<DD><DL>
261<DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>byte</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>byte</code> value
262<DT><B>Returns:</B><DD><code>true</code> if <code>array[i] == target</code> for some value of <code>i</code></DL>
263</DD>
264</DL>
265<HR>
266
267<A NAME="indexOf(byte[], byte)"><!-- --></A><H3>
268indexOf</H3>
269<PRE>
270public static int <B>indexOf</B>(byte[]&nbsp;array,
271                          byte&nbsp;target)</PRE>
272<DL>
273<DD>Returns the index of the first appearance of the value <code>target</code> in
274 <code>array</code>.
275<P>
276<DD><DL>
277<DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>byte</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>byte</code> value
278<DT><B>Returns:</B><DD>the least index <code>i</code> for which <code>array[i] == target</code>, or
279     <code>-1</code> if no such index exists.</DL>
280</DD>
281</DL>
282<HR>
283
284<A NAME="indexOf(byte[], byte[])"><!-- --></A><H3>
285indexOf</H3>
286<PRE>
287public static int <B>indexOf</B>(byte[]&nbsp;array,
288                          byte[]&nbsp;target)</PRE>
289<DL>
290<DD>Returns the start position of the first occurrence of the specified <code>target</code> within <code>array</code>, or <code>-1</code> if there is no such occurrence.
291
292 <p>More formally, returns the lowest index <code>i</code> such that <code>java.util.Arrays.copyOfRange(array, i, i + target.length)</code> contains exactly
293 the same elements as <code>target</code>.
294<P>
295<DD><DL>
296<DT><B>Parameters:</B><DD><CODE>array</CODE> - the array to search for the sequence <code>target</code><DD><CODE>target</CODE> - the array to search for as a sub-sequence of <code>array</code></DL>
297</DD>
298</DL>
299<HR>
300
301<A NAME="lastIndexOf(byte[], byte)"><!-- --></A><H3>
302lastIndexOf</H3>
303<PRE>
304public static int <B>lastIndexOf</B>(byte[]&nbsp;array,
305                              byte&nbsp;target)</PRE>
306<DL>
307<DD>Returns the index of the last appearance of the value <code>target</code> in
308 <code>array</code>.
309<P>
310<DD><DL>
311<DT><B>Parameters:</B><DD><CODE>array</CODE> - an array of <code>byte</code> values, possibly empty<DD><CODE>target</CODE> - a primitive <code>byte</code> value
312<DT><B>Returns:</B><DD>the greatest index <code>i</code> for which <code>array[i] == target</code>,
313     or <code>-1</code> if no such index exists.</DL>
314</DD>
315</DL>
316<HR>
317
318<A NAME="concat(byte[]...)"><!-- --></A><H3>
319concat</H3>
320<PRE>
321public static byte[] <B>concat</B>(byte[]...&nbsp;arrays)</PRE>
322<DL>
323<DD>Returns the values from each provided array combined into a single array.
324 For example, <code>concat(new byte[] {a, b}, new byte[] {}, new
325 byte[] {c}</code> returns the array <code>{a, b, c}</code>.
326<P>
327<DD><DL>
328<DT><B>Parameters:</B><DD><CODE>arrays</CODE> - zero or more <code>byte</code> arrays
329<DT><B>Returns:</B><DD>a single array containing all the values from the source arrays, in
330     order</DL>
331</DD>
332</DL>
333<HR>
334
335<A NAME="ensureCapacity(byte[], int, int)"><!-- --></A><H3>
336ensureCapacity</H3>
337<PRE>
338public static byte[] <B>ensureCapacity</B>(byte[]&nbsp;array,
339                                    int&nbsp;minLength,
340                                    int&nbsp;padding)</PRE>
341<DL>
342<DD>Returns an array containing the same values as <code>array</code>, but
343 guaranteed to be of a specified minimum length. If <code>array</code> already
344 has a length of at least <code>minLength</code>, it is returned directly.
345 Otherwise, a new array of size <code>minLength + padding</code> is returned,
346 containing the values of <code>array</code>, and zeroes in the remaining places.
347<P>
348<DD><DL>
349<DT><B>Parameters:</B><DD><CODE>array</CODE> - the source array<DD><CODE>minLength</CODE> - the minimum length the returned array must guarantee<DD><CODE>padding</CODE> - an extra amount to "grow" the array by if growth is
350     necessary
351<DT><B>Returns:</B><DD>an array containing the values of <code>array</code>, with guaranteed
352     minimum length <code>minLength</code>
353<DT><B>Throws:</B>
354<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang">IllegalArgumentException</A></CODE> - if <code>minLength</code> or <code>padding</code> is
355     negative</DL>
356</DD>
357</DL>
358<HR>
359
360<A NAME="toArray(java.util.Collection)"><!-- --></A><H3>
361toArray</H3>
362<PRE>
363public static byte[] <B>toArray</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/Collection.html?is-external=true" title="class or interface in java.util">Collection</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Byte.html?is-external=true" title="class or interface in java.lang">Byte</A>&gt;&nbsp;collection)</PRE>
364<DL>
365<DD>Copies a collection of <code>Byte</code> instances into a new array of
366 primitive <code>byte</code> values.
367
368 <p>Elements are copied from the argument collection as if by <code>collection.toArray()</code>.  Calling this method is as thread-safe as calling
369 that method.
370<P>
371<DD><DL>
372<DT><B>Parameters:</B><DD><CODE>collection</CODE> - a collection of <code>Byte</code> objects
373<DT><B>Returns:</B><DD>an array containing the same values as <code>collection</code>, in the
374     same order, converted to primitives
375<DT><B>Throws:</B>
376<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang">NullPointerException</A></CODE> - if <code>collection</code> or any of its elements
377     is null</DL>
378</DD>
379</DL>
380<HR>
381
382<A NAME="asList(byte...)"><!-- --></A><H3>
383asList</H3>
384<PRE>
385public static <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;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Byte.html?is-external=true" title="class or interface in java.lang">Byte</A>&gt; <B>asList</B>(byte...&nbsp;backingArray)</PRE>
386<DL>
387<DD>Returns a fixed-size list backed by the specified array, similar to <A HREF="http://java.sun.com/javase/6/docs/api/java/util/Arrays.html?is-external=true#asList(T...)" title="class or interface in java.util"><CODE>Arrays.asList(Object[])</CODE></A>. The list supports <A HREF="http://java.sun.com/javase/6/docs/api/java/util/List.html?is-external=true#set(int, E)" title="class or interface in java.util"><CODE>List.set(int, Object)</CODE></A>,
388 but any attempt to set a value to <code>null</code> will result in a <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/NullPointerException.html?is-external=true" title="class or interface in java.lang"><CODE>NullPointerException</CODE></A>.
389
390 <p>The returned list maintains the values, but not the identities, of
391 <code>Byte</code> objects written to or read from it.  For example, whether
392 <code>list.get(0) == list.get(0)</code> is true for the returned list is
393 unspecified.
394<P>
395<DD><DL>
396<DT><B>Parameters:</B><DD><CODE>backingArray</CODE> - the array to back the list
397<DT><B>Returns:</B><DD>a list view of the array</DL>
398</DD>
399</DL>
400<!-- ========= END OF CLASS DATA ========= -->
401<HR>
402
403
404<!-- ======= START OF BOTTOM NAVBAR ====== -->
405<A NAME="navbar_bottom"><!-- --></A>
406<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
407<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
408<TR>
409<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
410<A NAME="navbar_bottom_firstrow"><!-- --></A>
411<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
412  <TR ALIGN="center" VALIGN="top">
413  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
414  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
415  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
416  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Bytes.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
417  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
418  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
419  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
420  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
421  </TR>
422</TABLE>
423</TD>
424<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
425</EM>
426</TD>
427</TR>
428
429<TR>
430<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
431&nbsp;<A HREF="../../../../com/google/common/primitives/Booleans.html" title="class in com.google.common.primitives"><B>PREV CLASS</B></A>&nbsp;
432&nbsp;<A HREF="../../../../com/google/common/primitives/Chars.html" title="class in com.google.common.primitives"><B>NEXT CLASS</B></A></FONT></TD>
433<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
434  <A HREF="../../../../index.html?com/google/common/primitives/Bytes.html" target="_top"><B>FRAMES</B></A>  &nbsp;
435&nbsp;<A HREF="Bytes.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
436&nbsp;<SCRIPT type="text/javascript">
437  <!--
438  if(window==top) {
439    document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
440  }
441  //-->
442</SCRIPT>
443<NOSCRIPT>
444  <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
445</NOSCRIPT>
446
447
448</FONT></TD>
449</TR>
450<TR>
451<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
452  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
453<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
454DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
455</TR>
456</TABLE>
457<A NAME="skip-navbar_bottom"></A>
458<!-- ======== END OF BOTTOM NAVBAR ======= -->
459
460<HR>
461
462</BODY>
463</HTML>
464