Class BitInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, BitIn

    public class BitInputStream
    extends BitInBase
    This class reads from a file or an InputStream integers that can be coded with different encoding algorithms. It does not use any internal buffering, and operates with bytes.
    Author:
    Roi Blanco
    • Field Detail

      • dis

        protected java.io.DataInput dis
        The private input stream used internaly.
    • Constructor Detail

      • BitInputStream

        protected BitInputStream()
        Do nothing constructor used by child classes which override all methods, eg OldBitInputStream
      • BitInputStream

        public BitInputStream​(java.io.DataInput in)
                       throws java.io.IOException
        Constructs an instance of the class for a given stream
        Parameters:
        in - java.io.DataInput the underlying input stream
        Throws:
        java.io.IOException - if an I/O error occurs
      • BitInputStream

        public BitInputStream​(java.io.InputStream is)
                       throws java.io.IOException
        Constructs an instance of the class for a given stream
        Parameters:
        is - java.io.InputStream the underlying input stream
        Throws:
        java.io.IOException - if an I/O error occurs
      • BitInputStream

        public BitInputStream​(java.lang.String filename)
                       throws java.io.IOException
        Constructs an instance of the class for a given filename
        Parameters:
        filename - java.lang.String the name of the undelying file
        Throws:
        java.io.IOException - if an I/O error occurs
      • BitInputStream

        public BitInputStream​(java.io.File file)
                       throws java.io.IOException
        Constructs an instance of the class for a given file
        Parameters:
        file - java.io.File the underlying file
        Throws:
        java.io.IOException - if an I/O error occurs
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Closes the stream.
        Throws:
        java.io.IOException - if an I/O error occurs
      • skipBytes

        public void skipBytes​(long len)
                       throws java.io.IOException
        Skip a number of bytes while reading the bit file. After this opteration, getBitOffset() == 0, so use skipBits(int) to get getBitOffset() to desired value.
        Parameters:
        len - The number of bytes to skip
        Throws:
        java.io.IOException - if an I/O error occurs
      • incrByte

        protected void incrByte()
                         throws java.io.IOException
        Description copied from class: BitInBase
        Move forward one byte. The newly read byte should appear in the byteRead variable.
        Specified by:
        incrByte in class BitInBase
        Throws:
        java.io.IOException
      • incrByte

        protected void incrByte​(int i)
                         throws java.io.IOException
        Description copied from class: BitInBase
        Move forward i bytes. The newly read byte should appear in byteRead variable.
        Specified by:
        incrByte in class BitInBase
        Throws:
        java.io.IOException