public class StreamUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
readFully(java.io.InputStream inputStream,
byte[] array,
int offset,
int size)
Reads an exact number of bytes from the given input stream.
|
static void |
skipFully(java.io.InputStream inputStream,
long size)
Skips an exact number of bytes from the given input stream.
|
public static void readFully(java.io.InputStream inputStream,
byte[] array,
int offset,
int size)
throws java.io.IOException
inputStream - the input stream to read from.array - the array that will contain the data read.offset - the offset in the array of the first byte read.size - the number of bytes to read.java.io.EOFException - if the end of stream is reached before reading the given number of bytes.java.io.IOException - if an error occurred when reading from the input stream.public static void skipFully(java.io.InputStream inputStream,
long size)
throws java.io.IOException
inputStream - the input stream to skip from.size - the number of bytes to skip.java.io.EOFException - if the end of stream is reached before skipping the given number of bytes.java.io.IOException - if an error occurred when reading from the input stream.