Package htsjdk.samtools.cram.io
Class InputStreamUtils
java.lang.Object
htsjdk.samtools.cram.io.InputStreamUtils
Convenience methods to read from
InputStream
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
readFully
(InputStream input) Read theInputStream
until the end into a new byte array.static void
readFully
(InputStream inputStream, byte[] b, int off, int length) Read the specified number of bytes from theInputStream
into the byte array starting from the specified position.static byte[]
readFully
(InputStream inputStream, int length) Read the specified number of bytes from theInputStream
into a new byte array.static void
skipFully
(InputStream in, long length) Skip the specified number of bytes from theInputStream
.
-
Constructor Details
-
InputStreamUtils
public InputStreamUtils()
-
-
Method Details
-
readFully
Read theInputStream
until the end into a new byte array.- Parameters:
input
- the input stream to read- Returns:
- a new byte array containing data from the input stream
-
readFully
Read the specified number of bytes from theInputStream
into a new byte array. The length of the array is less or equal to length.- Parameters:
inputStream
- the input stream to read fromlength
- the number of bytes to read- Returns:
- a new byte array containing data from the input stream
- Throws:
RuntimeEOFException
- if there is less than length bytes in the stream
-
readFully
Read the specified number of bytes from theInputStream
into the byte array starting from the specified position. The length of the array is less or equal to length.- Parameters:
inputStream
- the input stream to read fromb
- the byte array to read intooff
- offset in the byte arraylength
- the number of bytes to read- Throws:
RuntimeEOFException
- if there is less than length bytes in the stream
-
skipFully
Skip the specified number of bytes from theInputStream
.- Parameters:
in
- the input stream to skip bytes fromlength
- the number of bytes to skip- Throws:
RuntimeEOFException
- if there is less than length bytes in the stream
-