Class BitReader
java.lang.Object
org.apache.tika.parser.microsoft.onenote.fsshttpb.util.BitReader
A class is used to extract values across byte boundaries with arbitrary bit positions.
-
Constructor Summary
ConstructorDescriptionBitReader
(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 TypeMethodDescriptionvoid
dispose()
Assign the internal read buffer to null.boolean
boolean
moveNext()
Advances the enumerator to the next bit of the byte array.byte[]
readBytes
(int readingLength) Reading the bytes specified by the byte length.readGuid()
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
reset()
Sets the enumerator to its initial position, which is before the first bit in the byte array.
-
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
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
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
- Throws:
IOException
-
readBytes
Reading the bytes specified by the byte length.- Parameters:
readingLength
- Specify the reading byte length.- Returns:
- Return the read bytes array.
- Throws:
IOException
-
readInt16
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
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
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.
-