Package htsjdk.samtools.cram.io
Class CramInt
java.lang.Object
htsjdk.samtools.cram.io.CramInt
Methods to read and write CRAM int values as given in the file format specification.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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 anInputStream
.static int
readInt32
(ByteBuffer buffer) Read unsigned little-endian 4 byte integer from anByteBuffer
.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 toOutputStream
encoded as CRAM int data type.
-
Constructor Details
-
CramInt
public CramInt()
-
-
Method Details
-
readInt32
Read unsigned little-endian 4 byte integer from anInputStream
.- 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
Read unsigned little-endian 4 byte integer from anByteBuffer
.- Parameters:
buffer
-ByteBuffer
to read from- Returns:
- an integer value read from the buffer
-
writeInt32
Write int value toOutputStream
encoded as CRAM int data type.- Parameters:
value
- value to be written outoutputStream
- 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
-