John W. Campbell
This class is used to get integer bit fields sequentially from a file.
Class, constructors and methods:
Class Details
Accessible Fields
Constructors
Methods
- Package:
- Jdl.JdlLib;
- Class name:
- JdlBitsReader
- Class definition:
- public class JdlBitsReader
- Extends:
- Object
- Implements:
- none
- Actions:
- none
The following accessible fields have been defined:
- final int[] masks
a single constructor is The following two constructors are available:
Constructors:
Standard constructor
This constructs the JdlBitFields object for a given buffered input stream.
- Constructor Definition:
- public JdlBitsReader (BufferedInputStream bis)
- Parameters List:
- bis
- The buffered input stream for the file to be read.
This section contains methods for reading integer bits fields from
the file or skipping a bits field.
Methods:
Read bits into integer - readInt
Read bits into integer - readUnsignedField
Skip bits - skipBits
This method reads the requested number of bits from the file and
interprets the bits read as a signed integer value.
Note: If the number of bits requested is more than 32, it is assumed
that they still represent an integer within the range of a 32 bit integer.
(if the number of bits requested is more than 32, the first 32 bits read
are returned, as read, in the 32 bit integer).
- Method Definition:
- public int readInt(int nbits) throws IOException
- Parameters List:
- nbits
- The number of bits to be read.
- Method Return:
-
An integer value formed from the bits read or 0 if more than 32
bits were requested.
This method reads an unsigned integer field up to 31 bits in length.
If the number of bits requested is >31, a zero value is returned though
the requested number of bits will be skipped
- Method Definition:
- public int readUnsignedField(int nbits) throws IOException
- Parameters List:
- nbits
- The number of bits to be read (<=31).
- Method Return:
-
An integer value formed from the bits read or 0 if more than 31
bits were requested. Throws IOException if premature end of file
This method skips the requested number of bits from the file.
- Method Definition:
- public void skipBits(int nbits) throws IOException
- Parameters List:
- none
- Method Return:
-
void - throws IOException if premature end of file
⇑ Up 2
⇑ Up 1
⇑ Top of this