Package htsjdk.samtools.cram.io

# Class CramInt

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

public class CramInt extends Object
Methods to read and write CRAM int values as given in the file format specification.

## Constructor Summary

Constructors
Constructor
Description
`CramInt()`

## Method Summary

Modifier and Type
Method
Description
`static int`
`readInt32(byte[] data)`
Read unsigned little-endian 4 byte integer from an array of bytes.
`static int`
`readInt32(InputStream inputStream)`
Read unsigned little-endian 4 byte integer from an `InputStream`.
`static int`
`readInt32(ByteBuffer buffer)`
Read unsigned little-endian 4 byte integer from an `ByteBuffer`.
`static byte[]`
`writeInt32(int value)`
Write int value to an array of bytes encoded as CRAM int data type.
`static int`
`writeInt32(int value, OutputStream outputStream)`
Write int value to `OutputStream` encoded as CRAM int data type.

### Methods inherited from class java.lang.Object

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

## Constructor Details

### CramInt

public CramInt()

## Method Details

### readInt32

public static int readInt32(InputStream inputStream)
Read unsigned little-endian 4 byte integer from an `InputStream`.

Parameters:
  `inputStream` - input stream to read from
Returns:
  an integer value read

### readInt32

public static int readInt32(byte[] data)
Read unsigned little-endian 4 byte integer from an array of bytes.

Parameters:
  `data` - input stream to read from
Returns:
  an integer value read

### readInt32

public static int readInt32(ByteBuffer buffer)
Read unsigned little-endian 4 byte integer from an `ByteBuffer`.

Parameters:
  `buffer` - `ByteBuffer` to read from
Returns:
  an integer value read from the buffer

### writeInt32

public static int writeInt32(int value, OutputStream outputStream)
Write int value to `OutputStream` encoded as CRAM int data type.

Parameters:
  `value` - value to be written out
  `outputStream` - the output stream
Returns:
  the number of bits written out

### writeInt32

public static byte[] writeInt32(int value)
Write int value to an array of bytes encoded as CRAM int data type.

Parameters:
  `value` - value to be written out
Returns:
  the byte array holding the value encoded as CRAM int data type