public class InputStreamUtils
extends java.lang.Object
InputStream
.Constructor and Description |
---|
InputStreamUtils() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
readFully(java.io.InputStream input)
Read the
InputStream until the end into a new byte array. |
static void |
readFully(java.io.InputStream inputStream,
byte[] b,
int off,
int length)
Read the specified number of bytes from the
InputStream into the byte array starting from the specified position. |
static byte[] |
readFully(java.io.InputStream inputStream,
int length)
Read the specified number of bytes from the
InputStream into a new byte array. |
public static byte[] readFully(java.io.InputStream input)
InputStream
until the end into a new byte array.input
- the input stream to readpublic static byte[] readFully(java.io.InputStream inputStream, int length) throws java.io.IOException
InputStream
into a new byte array. The length of the array is less or equal to
length.inputStream
- the input stream to read fromlength
- the number of bytes to readjava.io.IOException
- as per java IO contractjava.io.EOFException
- if there is less than length bytes in the streampublic static void readFully(java.io.InputStream inputStream, byte[] b, int off, int length) throws java.io.IOException
InputStream
into the byte array starting from the specified position. The length
of the array is less or equal to length.inputStream
- the input stream to read fromb
- the byte array to read intooff
- offset in the byte arraylength
- the number of bytes to readjava.io.IOException
- as per java IO contractjava.io.EOFException
- if there is less than length bytes in the stream