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 intreadInt32(byte[] data)Read unsigned little-endian 4 byte integer from an array of bytes.static intreadInt32(InputStream inputStream)Read unsigned little-endian 4 byte integer from anInputStream.static intreadInt32(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 intwriteInt32(int value, OutputStream outputStream)Write int value toOutputStreamencoded as CRAM int data type.
-
-
-
Method Detail
-
readInt32
public static int readInt32(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
-
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 anByteBuffer.- Parameters:
buffer-ByteBufferto read from- Returns:
- an integer value read from the buffer
-
writeInt32
public static int writeInt32(int value, OutputStream outputStream) throws IOExceptionWrite int value toOutputStreamencoded 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 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
-
-