Skip navigation links
oracle.dss.util.xdo.template.flash
Class BitsReader
java.lang.Object
oracle.dss.util.xdo.template.flash.BitsReader
- Direct Known Subclasses:
- SWFReader
-
public class BitsReader
- extends java.lang.Object
Read bits from a specified byte array Bit position is like this. 0000000 | | | +-- position(7) +-------- position(0) Example: BitsReader br = new BitsReader( data, 0, 0 ); int val = br.readBits( 5 ); // Read first 5 bits int val2 = br.readBits( 10 ); // Read next 10 bits ...
Constructor Summary |
BitsReader(byte[] data, int bytePos, int bitPos)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mData
protected byte[] mData
mBytePos
protected int mBytePos
mBitPos
protected int mBitPos
BitsReader
public BitsReader(byte[] data,
int bytePos,
int bitPos)
readBits
public int readBits(int numBits)
- Read specified bits from the current position. The current position will be moved after this operation.
-
- Parameters:
numBits
- number of bits (must be <=32)
- Returns:
- value
readBits
public static int readBits(byte data,
int startBit,
int endBit)
- Read bits within a byte. Bit position is like this. 0000000 | | | +-- position(7) +-------- position(0)
-
- Parameters:
data
-
start
- start bit position (0-7)
end
- end bit position (0-7)
- Returns:
readBits
public static int readBits(int data,
int startBit,
int endBit)
- Read bits within an int.
-
- Parameters:
data
-
startBit
-
endBit
-
- Returns:
skipFilledBits
public void skipFilledBits()
getBytePosition
public int getBytePosition()
getBitPosition
public int getBitPosition()
Skip navigation links
Copyright © 1997, 2009, Oracle. All rights reserved.