<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0-google-internal) on Mon Jan 04 20:47:59 PST 2010 -->
<TITLE>
ByteStreams (Guava Libraries 2010.01.04)
</TITLE>
<META NAME="date" CONTENT="2010-01-04">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="ByteStreams (Guava Libraries 2010.01.04)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ByteStreams.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/google/common/io/ByteProcessor.html" title="interface in com.google.common.io"><B>PREV CLASS</B></A>
<A HREF="../../../../com/google/common/io/CharStreams.html" title="class in com.google.common.io"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/google/common/io/ByteStreams.html" target="_top"><B>FRAMES</B></A>
<A HREF="ByteStreams.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.google.common.io</FONT>
<BR>
Class ByteStreams</H2>
<PRE>
<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>
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.io.ByteStreams</B>
</PRE>
<HR>
<DL>
<DT><PRE>public final class <B>ByteStreams</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>
</PRE>
<P>
Provides utility methods for working with byte arrays and I/O streams.
<p>All method parameters must be non-null unless documented otherwise.
<P>
<P>
<DL>
<DT><B>Since:</B></DT>
<DD>2009.09.15 <b>tentative</b></DD>
<DT><B>Author:</B></DT>
<DD>Chris Nokleberg</DD>
</DL>
<HR>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#copy(java.io.InputStream, java.io.OutputStream)">copy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> from,
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> to)</CODE>
<BR>
Copies all bytes from the input stream to the output stream.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#copy(com.google.common.io.InputSupplier, java.io.OutputStream)">copy</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> from,
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> to)</CODE>
<BR>
Opens an input stream from the supplier, copies all bytes from the
input to the output, and closes the input stream.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#copy(com.google.common.io.InputSupplier, com.google.common.io.OutputSupplier)">copy</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> from,
<A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A>> to)</CODE>
<BR>
Opens input and output streams from the given suppliers, copies all
bytes from the input to the output, and closes the streams.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#copy(java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel)">copy</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/ReadableByteChannel.html?is-external=true" title="class or interface in java.nio.channels">ReadableByteChannel</A> from,
<A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/WritableByteChannel.html?is-external=true" title="class or interface in java.nio.channels">WritableByteChannel</A> to)</CODE>
<BR>
Copies all bytes from the readable channel to the writable channel.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#equal(com.google.common.io.InputSupplier, com.google.common.io.InputSupplier)">equal</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier1,
<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier2)</CODE>
<BR>
Returns true if the supplied input streams contain the same bytes.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#getChecksum(com.google.common.io.InputSupplier, java.util.zip.Checksum)">getChecksum</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/zip/Checksum.html?is-external=true" title="class or interface in java.util.zip">Checksum</A> checksum)</CODE>
<BR>
Computes and returns the checksum value for a supplied input stream.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#getDigest(com.google.common.io.InputSupplier, java.security.MessageDigest)">getDigest</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier,
<A HREF="http://java.sun.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security">MessageDigest</A> md)</CODE>
<BR>
Computes and returns the digest value for a supplied input stream.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#join(com.google.common.io.InputSupplier...)">join</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>>... suppliers)</CODE>
<BR>
Varargs form of <A HREF="../../../../com/google/common/io/ByteStreams.html#join(java.lang.Iterable)"><CODE>join(Iterable)</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#join(java.lang.Iterable)">join</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>>> suppliers)</CODE>
<BR>
Joins multiple <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><CODE>InputStream</CODE></A> suppliers into a single supplier.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#length(com.google.common.io.InputSupplier)">length</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier)</CODE>
<BR>
Returns the length of a supplied input stream, in bytes.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../com/google/common/io/ByteArrayDataInput.html" title="interface in com.google.common.io">ByteArrayDataInput</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#newDataInput(byte[])">newDataInput</A></B>(byte[] bytes)</CODE>
<BR>
Returns a new <A HREF="../../../../com/google/common/io/ByteArrayDataInput.html" title="interface in com.google.common.io"><CODE>ByteArrayDataInput</CODE></A> instance to read from the <code>bytes</code> array from the beginning.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../com/google/common/io/ByteArrayDataInput.html" title="interface in com.google.common.io">ByteArrayDataInput</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#newDataInput(byte[], int)">newDataInput</A></B>(byte[] bytes,
int start)</CODE>
<BR>
Returns a new <A HREF="../../../../com/google/common/io/ByteArrayDataInput.html" title="interface in com.google.common.io"><CODE>ByteArrayDataInput</CODE></A> instance to read from the <code>bytes</code> array, starting at the given position.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../com/google/common/io/ByteArrayDataOutput.html" title="interface in com.google.common.io">ByteArrayDataOutput</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#newDataOutput()">newDataOutput</A></B>()</CODE>
<BR>
Returns a new <A HREF="../../../../com/google/common/io/ByteArrayDataOutput.html" title="interface in com.google.common.io"><CODE>ByteArrayDataOutput</CODE></A> instance with a default size.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../com/google/common/io/ByteArrayDataOutput.html" title="interface in com.google.common.io">ByteArrayDataOutput</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#newDataOutput(int)">newDataOutput</A></B>(int size)</CODE>
<BR>
Returns a new <A HREF="../../../../com/google/common/io/ByteArrayDataOutput.html" title="interface in com.google.common.io"><CODE>ByteArrayDataOutput</CODE></A> instance sized to hold
<code>size</code> bytes before resizing.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html?is-external=true" title="class or interface in java.io">ByteArrayInputStream</A>></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#newInputStreamSupplier(byte[])">newInputStreamSupplier</A></B>(byte[] b)</CODE>
<BR>
Returns a factory that will supply instances of
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html?is-external=true" title="class or interface in java.io"><CODE>ByteArrayInputStream</CODE></A> that read from the given byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html?is-external=true" title="class or interface in java.io">ByteArrayInputStream</A>></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#newInputStreamSupplier(byte[], int, int)">newInputStreamSupplier</A></B>(byte[] b,
int off,
int len)</CODE>
<BR>
Returns a factory that will supply instances of
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html?is-external=true" title="class or interface in java.io"><CODE>ByteArrayInputStream</CODE></A> that read from the given byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#read(java.io.InputStream, byte[], int, int)">read</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in,
byte[] b,
int off,
int len)</CODE>
<BR>
Reads some bytes from an input stream and stores them into the buffer array
<code>b</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
<TR ALIGN="right" VALIGN="">
<TD NOWRAP><FONT SIZE="-1">
<CODE><T> T</CODE></FONT></TD>
</TR>
</TABLE>
</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#readBytes(com.google.common.io.InputSupplier, com.google.common.io.ByteProcessor)">readBytes</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier,
<A HREF="../../../../com/google/common/io/ByteProcessor.html" title="interface in com.google.common.io">ByteProcessor</A><T> processor)</CODE>
<BR>
Process the bytes of a supplied stream</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#readFully(java.io.InputStream, byte[])">readFully</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in,
byte[] b)</CODE>
<BR>
Attempts to read enough bytes from the stream to fill the given byte array,
with the same behavior as <A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true#readFully(byte[])" title="class or interface in java.io"><CODE>DataInput.readFully(byte[])</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#readFully(java.io.InputStream, byte[], int, int)">readFully</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in,
byte[] b,
int off,
int len)</CODE>
<BR>
Attempts to read <code>len</code> bytes from the stream into the given array
starting at <code>off</code>, with the same behavior as
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true#readFully(byte[], int, int)" title="class or interface in java.io"><CODE>DataInput.readFully(byte[], int, int)</CODE></A>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#skipFully(java.io.InputStream, long)">skipFully</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in,
long n)</CODE>
<BR>
Discards <code>n</code> bytes of data from the input stream.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#slice(com.google.common.io.InputSupplier, long, long)">slice</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier,
long offset,
long length)</CODE>
<BR>
Returns an <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io"><CODE>InputSupplier</CODE></A> that returns input streams from the
an underlying supplier, where each stream starts at the given
offset and is limited to the specified number of bytes.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#toByteArray(java.io.InputStream)">toByteArray</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in)</CODE>
<BR>
Reads all bytes from an input stream into a byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#toByteArray(com.google.common.io.InputSupplier)">toByteArray</A></B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier)</CODE>
<BR>
Returns the data from a <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><CODE>InputStream</CODE></A> factory as a byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../com/google/common/io/ByteStreams.html#write(byte[], com.google.common.io.OutputSupplier)">write</A></B>(byte[] from,
<A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A>> to)</CODE>
<BR>
Writes a byte array to an output stream from the given supplier.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<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>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<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>
</TR>
</TABLE>
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="newInputStreamSupplier(byte[])"><!-- --></A><H3>
newInputStreamSupplier</H3>
<PRE>
public static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html?is-external=true" title="class or interface in java.io">ByteArrayInputStream</A>> <B>newInputStreamSupplier</B>(byte[] b)</PRE>
<DL>
<DD>Returns a factory that will supply instances of
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html?is-external=true" title="class or interface in java.io"><CODE>ByteArrayInputStream</CODE></A> that read from the given byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the input buffer
<DT><B>Returns:</B><DD>the factory</DL>
</DD>
</DL>
<HR>
<A NAME="newInputStreamSupplier(byte[], int, int)"><!-- --></A><H3>
newInputStreamSupplier</H3>
<PRE>
public static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html?is-external=true" title="class or interface in java.io">ByteArrayInputStream</A>> <B>newInputStreamSupplier</B>(byte[] b,
int off,
int len)</PRE>
<DL>
<DD>Returns a factory that will supply instances of
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/ByteArrayInputStream.html?is-external=true" title="class or interface in java.io"><CODE>ByteArrayInputStream</CODE></A> that read from the given byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>b</CODE> - the input buffer<DD><CODE>off</CODE> - the offset in the buffer of the first byte to read<DD><CODE>len</CODE> - the maximum number of bytes to read from the buffer
<DT><B>Returns:</B><DD>the factory</DL>
</DD>
</DL>
<HR>
<A NAME="write(byte[], com.google.common.io.OutputSupplier)"><!-- --></A><H3>
write</H3>
<PRE>
public static void <B>write</B>(byte[] from,
<A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A>> to)
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>
<DL>
<DD>Writes a byte array to an output stream from the given supplier.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the bytes to write<DD><CODE>to</CODE> - the output supplier
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="copy(com.google.common.io.InputSupplier, com.google.common.io.OutputSupplier)"><!-- --></A><H3>
copy</H3>
<PRE>
public static long <B>copy</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> from,
<A HREF="../../../../com/google/common/io/OutputSupplier.html" title="interface in com.google.common.io">OutputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A>> to)
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>
<DL>
<DD>Opens input and output streams from the given suppliers, copies all
bytes from the input to the output, and closes the streams.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the input factory<DD><CODE>to</CODE> - the output factory
<DT><B>Returns:</B><DD>the number of bytes copied
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="copy(com.google.common.io.InputSupplier, java.io.OutputStream)"><!-- --></A><H3>
copy</H3>
<PRE>
public static long <B>copy</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> from,
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> to)
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>
<DL>
<DD>Opens an input stream from the supplier, copies all bytes from the
input to the output, and closes the input stream. Does not close
or flush the output stream.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the input factory<DD><CODE>to</CODE> - the output stream to write to
<DT><B>Returns:</B><DD>the number of bytes copied
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="copy(java.io.InputStream, java.io.OutputStream)"><!-- --></A><H3>
copy</H3>
<PRE>
public static long <B>copy</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> from,
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</A> to)
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>
<DL>
<DD>Copies all bytes from the input stream to the output stream.
Does not close or flush either stream.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the input stream to read from<DD><CODE>to</CODE> - the output stream to write to
<DT><B>Returns:</B><DD>the number of bytes copied
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="copy(java.nio.channels.ReadableByteChannel, java.nio.channels.WritableByteChannel)"><!-- --></A><H3>
copy</H3>
<PRE>
public static long <B>copy</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/ReadableByteChannel.html?is-external=true" title="class or interface in java.nio.channels">ReadableByteChannel</A> from,
<A HREF="http://java.sun.com/javase/6/docs/api/java/nio/channels/WritableByteChannel.html?is-external=true" title="class or interface in java.nio.channels">WritableByteChannel</A> to)
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>
<DL>
<DD>Copies all bytes from the readable channel to the writable channel.
Does not close or flush either channel.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>from</CODE> - the readable channel to read from<DD><CODE>to</CODE> - the writable channel to write to
<DT><B>Returns:</B><DD>the number of bytes copied
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="toByteArray(java.io.InputStream)"><!-- --></A><H3>
toByteArray</H3>
<PRE>
public static byte[] <B>toByteArray</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in)
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>
<DL>
<DD>Reads all bytes from an input stream into a byte array.
Does not close the stream.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>in</CODE> - the input stream to read from
<DT><B>Returns:</B><DD>a byte array containing all the bytes from the stream
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="toByteArray(com.google.common.io.InputSupplier)"><!-- --></A><H3>
toByteArray</H3>
<PRE>
public static byte[] <B>toByteArray</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier)
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>
<DL>
<DD>Returns the data from a <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><CODE>InputStream</CODE></A> factory as a byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>supplier</CODE> - the factory
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="newDataInput(byte[])"><!-- --></A><H3>
newDataInput</H3>
<PRE>
public static <A HREF="../../../../com/google/common/io/ByteArrayDataInput.html" title="interface in com.google.common.io">ByteArrayDataInput</A> <B>newDataInput</B>(byte[] bytes)</PRE>
<DL>
<DD>Returns a new <A HREF="../../../../com/google/common/io/ByteArrayDataInput.html" title="interface in com.google.common.io"><CODE>ByteArrayDataInput</CODE></A> instance to read from the <code>bytes</code> array from the beginning.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newDataInput(byte[], int)"><!-- --></A><H3>
newDataInput</H3>
<PRE>
public static <A HREF="../../../../com/google/common/io/ByteArrayDataInput.html" title="interface in com.google.common.io">ByteArrayDataInput</A> <B>newDataInput</B>(byte[] bytes,
int start)</PRE>
<DL>
<DD>Returns a new <A HREF="../../../../com/google/common/io/ByteArrayDataInput.html" title="interface in com.google.common.io"><CODE>ByteArrayDataInput</CODE></A> instance to read from the <code>bytes</code> array, starting at the given position.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if <code>start</code> is negative or greater
than the length of the array</DL>
</DD>
</DL>
<HR>
<A NAME="newDataOutput()"><!-- --></A><H3>
newDataOutput</H3>
<PRE>
public static <A HREF="../../../../com/google/common/io/ByteArrayDataOutput.html" title="interface in com.google.common.io">ByteArrayDataOutput</A> <B>newDataOutput</B>()</PRE>
<DL>
<DD>Returns a new <A HREF="../../../../com/google/common/io/ByteArrayDataOutput.html" title="interface in com.google.common.io"><CODE>ByteArrayDataOutput</CODE></A> instance with a default size.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="newDataOutput(int)"><!-- --></A><H3>
newDataOutput</H3>
<PRE>
public static <A HREF="../../../../com/google/common/io/ByteArrayDataOutput.html" title="interface in com.google.common.io">ByteArrayDataOutput</A> <B>newDataOutput</B>(int size)</PRE>
<DL>
<DD>Returns a new <A HREF="../../../../com/google/common/io/ByteArrayDataOutput.html" title="interface in com.google.common.io"><CODE>ByteArrayDataOutput</CODE></A> instance sized to hold
<code>size</code> bytes before resizing.
<P>
<DD><DL>
<DT><B>Throws:</B>
<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>size</code> is negative</DL>
</DD>
</DL>
<HR>
<A NAME="length(com.google.common.io.InputSupplier)"><!-- --></A><H3>
length</H3>
<PRE>
public static long <B>length</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier)
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>
<DL>
<DD>Returns the length of a supplied input stream, in bytes.
<P>
<DD><DL>
<DT><B>Throws:</B>
<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>
</DD>
</DL>
<HR>
<A NAME="equal(com.google.common.io.InputSupplier, com.google.common.io.InputSupplier)"><!-- --></A><H3>
equal</H3>
<PRE>
public static boolean <B>equal</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier1,
<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier2)
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>
<DL>
<DD>Returns true if the supplied input streams contain the same bytes.
<P>
<DD><DL>
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="readFully(java.io.InputStream, byte[])"><!-- --></A><H3>
readFully</H3>
<PRE>
public static void <B>readFully</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in,
byte[] b)
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>
<DL>
<DD>Attempts to read enough bytes from the stream to fill the given byte array,
with the same behavior as <A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true#readFully(byte[])" title="class or interface in java.io"><CODE>DataInput.readFully(byte[])</CODE></A>.
Does not close the stream.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>in</CODE> - the input stream to read from.<DD><CODE>b</CODE> - the buffer into which the data is read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/EOFException.html?is-external=true" title="class or interface in java.io">EOFException</A></CODE> - if this stream reaches the end before reading all
the bytes.
<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> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>
<A NAME="readFully(java.io.InputStream, byte[], int, int)"><!-- --></A><H3>
readFully</H3>
<PRE>
public static void <B>readFully</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in,
byte[] b,
int off,
int len)
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>
<DL>
<DD>Attempts to read <code>len</code> bytes from the stream into the given array
starting at <code>off</code>, with the same behavior as
<A HREF="http://java.sun.com/javase/6/docs/api/java/io/DataInput.html?is-external=true#readFully(byte[], int, int)" title="class or interface in java.io"><CODE>DataInput.readFully(byte[], int, int)</CODE></A>. Does not close the
stream.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>in</CODE> - the input stream to read from.<DD><CODE>b</CODE> - the buffer into which the data is read.<DD><CODE>off</CODE> - an int specifying the offset into the data.<DD><CODE>len</CODE> - an int specifying the number of bytes to read.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/EOFException.html?is-external=true" title="class or interface in java.io">EOFException</A></CODE> - if this stream reaches the end before reading all
the bytes.
<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> - if an I/O error occurs.</DL>
</DD>
</DL>
<HR>
<A NAME="skipFully(java.io.InputStream, long)"><!-- --></A><H3>
skipFully</H3>
<PRE>
public static void <B>skipFully</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in,
long n)
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>
<DL>
<DD>Discards <code>n</code> bytes of data from the input stream. This method
will block until the full amount has been skipped. Does not close the
stream.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>in</CODE> - the input stream to read from<DD><CODE>n</CODE> - the number of bytes to skip
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/io/EOFException.html?is-external=true" title="class or interface in java.io">EOFException</A></CODE> - if this stream reaches the end before skipping all
the bytes
<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> - if an I/O error occurs, or the stream does not
support skipping</DL>
</DD>
</DL>
<HR>
<A NAME="readBytes(com.google.common.io.InputSupplier, com.google.common.io.ByteProcessor)"><!-- --></A><H3>
readBytes</H3>
<PRE>
public static <T> T <B>readBytes</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier,
<A HREF="../../../../com/google/common/io/ByteProcessor.html" title="interface in com.google.common.io">ByteProcessor</A><T> processor)
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>
<DL>
<DD>Process the bytes of a supplied stream
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>supplier</CODE> - the input stream factory<DD><CODE>processor</CODE> - the object to which to pass the bytes of the stream
<DT><B>Returns:</B><DD>the result of the byte processor
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="getChecksum(com.google.common.io.InputSupplier, java.util.zip.Checksum)"><!-- --></A><H3>
getChecksum</H3>
<PRE>
public static long <B>getChecksum</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/zip/Checksum.html?is-external=true" title="class or interface in java.util.zip">Checksum</A> checksum)
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>
<DL>
<DD>Computes and returns the checksum value for a supplied input stream.
The checksum object is reset when this method returns successfully.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>supplier</CODE> - the input stream factory<DD><CODE>checksum</CODE> - the checksum object
<DT><B>Returns:</B><DD>the result of <A HREF="http://java.sun.com/javase/6/docs/api/java/util/zip/Checksum.html?is-external=true#getValue()" title="class or interface in java.util.zip"><CODE>Checksum.getValue()</CODE></A> after updating the
checksum object with all of the bytes in the stream
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="getDigest(com.google.common.io.InputSupplier, java.security.MessageDigest)"><!-- --></A><H3>
getDigest</H3>
<PRE>
public static byte[] <B>getDigest</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier,
<A HREF="http://java.sun.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true" title="class or interface in java.security">MessageDigest</A> md)
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>
<DL>
<DD>Computes and returns the digest value for a supplied input stream.
The digest object is reset when this method returns successfully.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>supplier</CODE> - the input stream factory<DD><CODE>md</CODE> - the digest object
<DT><B>Returns:</B><DD>the result of <A HREF="http://java.sun.com/javase/6/docs/api/java/security/MessageDigest.html?is-external=true#digest()" title="class or interface in java.security"><CODE>MessageDigest.digest()</CODE></A> after updating the
digest object with all of the bytes in the stream
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="read(java.io.InputStream, byte[], int, int)"><!-- --></A><H3>
read</H3>
<PRE>
public static int <B>read</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A> in,
byte[] b,
int off,
int len)
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>
<DL>
<DD>Reads some bytes from an input stream and stores them into the buffer array
<code>b</code>. This method blocks until <code>len</code> bytes of input data have
been read into the array, or end of file is detected. The number of bytes
read is returned, possibly zero. Does not close the stream.
<p>A caller can detect EOF if the number of bytes read is less than
<code>len</code>. All subsequent calls on the same stream will return zero.
<p>If <code>b</code> is null, a <code>NullPointerException</code> is thrown. If
<code>off</code> is negative, or <code>len</code> is negative, or <code>off+len</code> is
greater than the length of the array <code>b</code>, then an
<code>IndexOutOfBoundsException</code> is thrown. If <code>len</code> is zero, then
no bytes are read. Otherwise, the first byte read is stored into element
<code>b[off]</code>, the next one into <code>b[off+1]</code>, and so on. The number
of bytes read is, at most, equal to <code>len</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>in</CODE> - the input stream to read from<DD><CODE>b</CODE> - the buffer into which the data is read<DD><CODE>off</CODE> - an int specifying the offset into the data<DD><CODE>len</CODE> - an int specifying the number of bytes to read
<DT><B>Returns:</B><DD>the number of bytes read
<DT><B>Throws:</B>
<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> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="slice(com.google.common.io.InputSupplier, long, long)"><!-- --></A><H3>
slice</H3>
<PRE>
public static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> <B>slice</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> supplier,
long offset,
long length)</PRE>
<DL>
<DD>Returns an <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io"><CODE>InputSupplier</CODE></A> that returns input streams from the
an underlying supplier, where each stream starts at the given
offset and is limited to the specified number of bytes.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>supplier</CODE> - the supplier from which to get the raw streams<DD><CODE>offset</CODE> - the offset in bytes into the underlying stream where
the returned streams will start<DD><CODE>length</CODE> - the maximum length of the returned streams
<DT><B>Throws:</B>
<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 offset or length are negative</DL>
</DD>
</DL>
<HR>
<A NAME="join(java.lang.Iterable)"><!-- --></A><H3>
join</H3>
<PRE>
public static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> <B>join</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A><? extends <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>>> suppliers)</PRE>
<DL>
<DD>Joins multiple <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io"><CODE>InputStream</CODE></A> suppliers into a single supplier.
Streams returned from the supplier will contain the concatenated data from
the streams of the underlying suppliers.
<p>Only one underlying input stream will be open at a time. Closing the
joined stream will close the open underlying stream.
<p>Reading from the joined stream will throw 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>
if any of the suppliers are null or return null.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>suppliers</CODE> - the suppliers to concatenate
<DT><B>Returns:</B><DD>a supplier that will return a stream containing the concatenated
stream data</DL>
</DD>
</DL>
<HR>
<A NAME="join(com.google.common.io.InputSupplier...)"><!-- --></A><H3>
join</H3>
<PRE>
public static <A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><<A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>> <B>join</B>(<A HREF="../../../../com/google/common/io/InputSupplier.html" title="interface in com.google.common.io">InputSupplier</A><? extends <A HREF="http://java.sun.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</A>>... suppliers)</PRE>
<DL>
<DD>Varargs form of <A HREF="../../../../com/google/common/io/ByteStreams.html#join(java.lang.Iterable)"><CODE>join(Iterable)</CODE></A>.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/ByteStreams.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../com/google/common/io/ByteProcessor.html" title="interface in com.google.common.io"><B>PREV CLASS</B></A>
<A HREF="../../../../com/google/common/io/CharStreams.html" title="class in com.google.common.io"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?com/google/common/io/ByteStreams.html" target="_top"><B>FRAMES</B></A>
<A HREF="ByteStreams.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>