public class IOUtils extends Object
Modifier and Type | Method and Description |
---|---|
static byte[] |
getStreamAsByteArray(InputStream stream)
Returns the contents of the input stream as byte array.
|
static byte[] |
getStreamAsByteArray(InputStream stream,
int length)
Returns the contents of the input stream as byte array.
|
static int |
readFully(InputStream in,
byte[] b)
Reads into a byte array.
|
static int |
readFully(InputStream in,
byte[] b,
int off,
int len)
Same as the normal in.read(b, off, len), but tries to ensure that the entire len
number of bytes is read.
|
public static int readFully(InputStream in, byte[] b) throws IOException
IOException
readFully(java.io.InputStream, byte[], int, int)
public static int readFully(InputStream in, byte[] b, int off, int len) throws IOException
IOException
public static byte[] getStreamAsByteArray(InputStream stream) throws IOException
stream
- the InputStream
IOException
public static byte[] getStreamAsByteArray(InputStream stream, int length) throws IOException
stream
- the InputStream
length
- the number of bytes to copy, if length < 0, the number is unlimitedIOException
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.