Class CramInt


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

      • CramInt

        public CramInt()
    • Method Detail

      • 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