Class ITF8


  • public class ITF8
    extends Object
    Methods to read and write int values as per ITF8 specification in CRAM.
    • Constructor Detail

      • ITF8

        public ITF8()
    • Method Detail

      • readUnsignedITF8

        public static int readUnsignedITF8​(InputStream inputStream)
                                    throws IOException
        Reads an unsigned (32 bit) integer from an InputStream. The sign bit should be interpreted as a value bit.
        Parameters:
        inputStream - the stream to read from
        Returns:
        the value read
        Throws:
        IOException - as per java IO contract
      • writeUnsignedITF8

        public static int writeUnsignedITF8​(int value,
                                            OutputStream outputStream)
                                     throws IOException
        Writes an unsigned (32 bit) integer to an OutputStream encoded as ITF8. The sign bit is interpreted as a value bit.
        Parameters:
        value - the value to be written out
        outputStream - the stream to write to
        Returns:
        number of bits written
        Throws:
        IOException - as per java IO contract
      • readUnsignedITF8

        public static int readUnsignedITF8​(byte[] data)
        Reads an unsigned (32 bit) integer from an array of bytes. The sign bit should be interpreted as a value bit.
        Parameters:
        data - the bytes to read from
        Returns:
        the value read
      • writeUnsignedITF8

        public static byte[] writeUnsignedITF8​(int value)
        Writes an unsigned (32 bit) integer to a byte new array encoded as ITF8. The sign bit is interpreted as a value bit.
        Parameters:
        value - the value to be written out
        Returns:
        the bytes holding ITF8 representation of the value
      • readUnsignedITF8

        public static int readUnsignedITF8​(ByteBuffer buffer)
        Reads an unsigned (32 bit) integer from a ByteBuffer. The sign bit should be interpreted as a value bit.
        Parameters:
        buffer - the bytes to read from
        Returns:
        unsigned integer value from the buffer
      • writeUnsignedITF8

        public static void writeUnsignedITF8​(int value,
                                             ByteBuffer buffer)
        Writes an unsigned (32 bit) integer to an OutputStream encoded as ITF8. The sign bit is interpreted as a value bit.
        Parameters:
        value - the value to be written out
        buffer - the ByteBuffer to write to