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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
int32(byte[] data)
Read unsigned little-endian 4 byte integer from an array of bytes.static int
int32(InputStream inputStream)
Read unsigned little-endian 4 byte integer from anInputStream
.static int
int32(ByteBuffer buffer)
Read unsigned little-endian 4 byte integer from anByteBuffer
.static byte[]
writeInt32(int value)
Write int value toOutputStream
encoded as CRAM int data type.static int
writeInt32(int value, OutputStream outputStream)
Write int value toOutputStream
encoded as CRAM int data type.
-
-
-
Method Detail
-
int32
public static int int32(InputStream inputStream) throws IOException
Read unsigned little-endian 4 byte integer from anInputStream
.- Parameters:
inputStream
- input stream to read from- Returns:
- an integer value read
- Throws:
IOException
- as per java IO contract
-
int32
public static int int32(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
-
int32
public static int int32(ByteBuffer buffer)
Read unsigned little-endian 4 byte integer from anByteBuffer
.- Parameters:
buffer
-ByteBuffer
to read from- Returns:
- an integer value read from the buffer
-
writeInt32
public static int writeInt32(int value, OutputStream outputStream) throws IOException
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
- Throws:
IOException
- as per java IO contract
-
writeInt32
public static byte[] writeInt32(int value)
Write int value toOutputStream
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
-
-