2.10.2 - Bits Reader - JdlBitsReader

John W. Campbell

2.10.2.1 Introduction

This class is used to get integer bit fields sequentially from a file.

Class, constructors and methods:

Class Details
Accessible Fields
Constructors
Methods

2.10.2.2 Class Details

Package:
Jdl.JdlLib;
Class name:
JdlBitsReader
Class definition:
public class JdlBitsReader
Extends:
Object
Implements:
none
Actions:
none

2.10.2.3 Accessible Fields

The following accessible fields have been defined:

final int[] masks

2.10.2.4 Constructors

2.10.2.4.1 Introduction

a single constructor is The following two constructors are available:

Constructors:

Standard constructor

2.10.2.4.2 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.

2.10.2.5 Methods

2.10.2.5.1 Introduction

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

2.10.2.5.2 Read bits into integer - readInt

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.

2.10.2.5.3 Read bits into integer - readUnsignedField

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

2.10.2.5.4 Skip bits - skipBits

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