Package ej.basictool
Class StreamUtils
- java.lang.Object
-
- ej.basictool.StreamUtils
-
public class StreamUtils extends Object
Provides utility methods to manipulate streams.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidreadFully(InputStream inputStream, byte[] array, int offset, int size)Reads an exact number of bytes from the given input stream.static voidskipFully(InputStream inputStream, long size)Skips an exact number of bytes from the given input stream.
-
-
-
Method Detail
-
readFully
public static void readFully(InputStream inputStream, byte[] array, int offset, int size) throws IOException
Reads an exact number of bytes from the given input stream.- Parameters:
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.- Throws:
EOFException- if the end of stream is reached before reading the given number of bytes.IOException- if an error occurred when reading from the input stream.
-
skipFully
public static void skipFully(InputStream inputStream, long size) throws IOException
Skips an exact number of bytes from the given input stream.- Parameters:
inputStream- the input stream to skip from.size- the number of bytes to skip.- Throws:
EOFException- if the end of stream is reached before skipping the given number of bytes.IOException- if an error occurred when reading from the input stream.
-
-