public final class IOUtils extends Object
Modifier and Type | Method and Description |
---|---|
static long |
copy(InputStream input,
OutputStream output)
Copies the content of a InputStream into an OutputStream.
|
static long |
copy(InputStream input,
OutputStream output,
int buffersize)
Copies the content of a InputStream into an OutputStream
|
static byte[] |
toByteArray(InputStream input)
Gets the contents of an
InputStream as a byte[] . |
public static long copy(InputStream input, OutputStream output) throws IOException
input
- the InputStream to copyoutput
- the target StreamIOException
- if an error occurspublic static long copy(InputStream input, OutputStream output, int buffersize) throws IOException
input
- the InputStream to copyoutput
- the target Streambuffersize
- the buffer size to useIOException
- if an error occurspublic static byte[] toByteArray(InputStream input) throws IOException
InputStream
as a byte[]
.
This method buffers the input internally, so there is no need to use a
BufferedInputStream
.
input
- the InputStream
to read fromNullPointerException
- if the input is nullIOException
- if an I/O error occursCopyright © 2015 The Apache Software Foundation. All Rights Reserved.