# Class InputStreamUtils

java.lang.Object
htsjdk.samtools.cram.io.InputStreamUtils

public class InputStreamUtils extends Object
Convenience methods to read from `InputStream`.

## Constructor Summary

Constructors
Constructor
Description
`InputStreamUtils()`

## Method Summary

Modifier and Type
Method
Description
`static byte[]`
`readFully(InputStream input)`
Read the `InputStream` 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 the `InputStream` into the byte array starting from the specified position.
`static byte[]`
`readFully(InputStream inputStream, int length)`
Read the specified number of bytes from the `InputStream` into a new byte array.
`static void`
`skipFully(InputStream in, long length)`
Skip the specified number of bytes from the `InputStream`.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### InputStreamUtils

public InputStreamUtils()

## Method Details

### readFully

public static byte[] readFully(InputStream input)
Read the `InputStream` 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

public static byte[] readFully(InputStream inputStream, int length)
Read the specified number of bytes from the `InputStream` into a new byte array. The length of the array is less or equal to length.

Parameters:
  `inputStream` - the input stream to read from
  `length` - 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

public static void readFully(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. The length of the array is less or equal to length.

Parameters:
  `inputStream` - the input stream to read from
  `b` - the byte array to read into
  `off` - offset in the byte array
  `length` - the number of bytes to read
Throws:
  `RuntimeEOFException` - if there is less than length bytes in the stream

### skipFully

public static void skipFully(InputStream in, long length)
Skip the specified number of bytes from the `InputStream`.

Parameters:
  `in` - the input stream to skip bytes from
  `length` - the number of bytes to skip
Throws:
  `RuntimeEOFException` - if there is less than length bytes in the stream