java.lang.Object
org.apache.tika.parser.microsoft.onenote.fsshttpb.util.BitReader

public class BitReader extends Object
A class is used to extract values across byte boundaries with arbitrary bit positions.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BitReader(byte[] array, int index)
    Initializes a new instance of the BitReader class with specified bytes buffer and start position in byte.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Assign the internal read buffer to null.
    boolean
     
    boolean
    Advances the enumerator to the next bit of the byte array.
    byte[]
    readBytes(int readingLength)
    Reading the bytes specified by the byte length.
    Read as a GUID from the current offset position and increate the bit offset with 128 bit.
    short
    readInt16(int readingLength)
    Read specified bit length content as an UInt16 type and increase the bit offset with the specified length.
    int
    readInt32(int readingLength)
    Read specified bit length content as an Int32 type and increase the bit offset with the specified length.
    int
    readUInt16(int readingLength)
     
    int
    readUInt32(int readingLength)
    Read specified bit length content as an UInt32 type and increase the bit offset with the specified length.
    long
    readUInt64(int readingLength)
    Read specified bit length content as an UInt64 type and increase the bit offset.
    void
    Sets the enumerator to its initial position, which is before the first bit in the byte array.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BitReader

      public BitReader(byte[] array, int index)
      Initializes a new instance of the BitReader class with specified bytes buffer and start position in byte.
      Parameters:
      array - Specify the byte array which contains the bytes need to be read.
      index - Specify the start position in byte.
  • Method Details

    • getCurrent

      public boolean getCurrent()
    • readUInt64

      public long readUInt64(int readingLength) throws IOException
      Read specified bit length content as an UInt64 type and increase the bit offset.
      Parameters:
      readingLength - Specify the reading bit length.
      Returns:
      Return the UInt64 type value.
      Throws:
      IOException
    • readUInt32

      public int readUInt32(int readingLength) throws IOException
      Read specified bit length content as an UInt32 type and increase the bit offset with the specified length.
      Parameters:
      readingLength - Specify the reading bit length.
      Returns:
      Return the UInt32 type value.
      Throws:
      IOException
    • readUInt16

      public int readUInt16(int readingLength) throws IOException
      Throws:
      IOException
    • readBytes

      public byte[] readBytes(int readingLength) throws IOException
      Reading the bytes specified by the byte length.
      Parameters:
      readingLength - Specify the reading byte length.
      Returns:
      Return the read bytes array.
      Throws:
      IOException
    • readInt16

      public short readInt16(int readingLength) throws IOException
      Read specified bit length content as an UInt16 type and increase the bit offset with the specified length.
      Parameters:
      readingLength - Specify the reading bit length.
      Returns:
      Return the UInt16 value.
      Throws:
      IOException
    • readInt32

      public int readInt32(int readingLength) throws IOException
      Read specified bit length content as an Int32 type and increase the bit offset with the specified length.
      Parameters:
      readingLength - Specify the reading bit length.
      Returns:
      Return the Int32 type value.
      Throws:
      IOException
    • readGuid

      public UUID readGuid() throws IOException
      Read as a GUID from the current offset position and increate the bit offset with 128 bit.
      Returns:
      Return the GUID value.
      Throws:
      IOException
    • moveNext

      public boolean moveNext()
      Advances the enumerator to the next bit of the byte array.
      Returns:
      true if the enumerator was successfully advanced to the next bit; false if the enumerator has passed the end of the byte array.
    • dispose

      public void dispose()
      Assign the internal read buffer to null.
    • reset

      public void reset()
      Sets the enumerator to its initial position, which is before the first bit in the byte array.