edu.columbia.ee.flavor
Interface IBitstream

All Known Implementing Classes:
Bitstream

public interface IBitstream

The definition of the Bitstream I/O interface, this is defines the methods that the Flavor translator expects from the underlying class that performs bitstream I/O.

See Also:
FlIOException

Field Summary
static int BS_INPUT
          Input bitstream type
static int BS_OUTPUT
          Output bitstream type
 
Method Summary
 int align(int n)
          Aligns the bitstream to 8 bit boundary (n must be a multiple of 8, both input/output)
 boolean atend()
          Test end-of-data
 int getbits(int n)
          Gets next 'n' bits as unsigned value (input only)
 double getdouble()
          Gets next double value in next 32 bits (output only)
 float getfloat()
          Gets next float value in next 32 bits (input only)
 int getmode()
          Returns mode(BS_INPUT or BS_OUTPUT)
 int getpos()
          Gets current position (both input/output)
 int little_getbits(int n)
          Gets next 'n' bits as unsigned value using the little-endian method (input only)
 double little_getdouble()
          Gets next double value in next 32 bits using the little-endian method (output only)
 float little_getfloat()
          Gets next float value in next 32 bits using the little-endian method (input only)
 int little_nextbits(int n)
          Probes 'n' bits as unsigned value using the little-endian method (input only)
 double little_nextdouble()
          Probes next double value in next 32 bits using the little-endian method (input only)
 float little_nextfloat()
          Probes next float value in next 32 bits using the little-endian method (input only)
 int little_putbits(int bits, int n)
          Puts 'n' bits using the little-endian method (output only)
 double little_putdouble(double d)
          Puts double value into next 32 bits using the little-endian method (output only)
 float little_putfloat(float f)
          Puts float value into next 32 bits using the little-endian method (input only)
 int little_sgetbits(int n)
          Gets next 'n' bits as signed value using the little-endian method (input only)
 int little_snextbits(int n)
          Probes 'n' bits as signed value using the little-endian method (input only)
 int nextbits(int n)
          Probes 'n' bits as unsigned value (input only)
 double nextdouble()
          Probes next double value in next 32 bits (input only)
 float nextfloat()
          Probes next float value in next 32 bits (input only)
 int putbits(int bits, int n)
          Puts 'n' bits (output only)
 double putdouble(double d)
          Puts double value into next 32 bits (output only)
 float putfloat(float f)
          Puts float value into next 32 bits (input only)
 int sgetbits(int n)
          Gets next 'n' bits as signed value (input only)
 void skipbits(int n)
          Skips next 'n' bits (both input/output)
 int snextbits(int n)
          Probes 'n' bits as signed value (input only)
 

Field Detail

BS_INPUT

public static final int BS_INPUT
Input bitstream type

See Also:
Constant Field Values

BS_OUTPUT

public static final int BS_OUTPUT
Output bitstream type

See Also:
Constant Field Values
Method Detail

getbits

public int getbits(int n)
            throws FlIOException
Gets next 'n' bits as unsigned value (input only)

Parameters:
n - The number of bits to get
Returns:
The value of next n bits
Throws:
FlIOException - if an I/O error occurs

sgetbits

public int sgetbits(int n)
             throws FlIOException
Gets next 'n' bits as signed value (input only)

Parameters:
n - The number of bits to get
Returns:
The value of next n bits
Throws:
FlIOException - if an I/O error occurs

nextbits

public int nextbits(int n)
             throws FlIOException
Probes 'n' bits as unsigned value (input only)

Parameters:
n - The number of bits to get
Returns:
The value of next n bits
Throws:
FlIOException - if an I/O error occurs

snextbits

public int snextbits(int n)
              throws FlIOException
Probes 'n' bits as signed value (input only)

Parameters:
n - The number of bits to get
Returns:
The value of next n bits
Throws:
FlIOException - if an I/O error occurs

getfloat

public float getfloat()
               throws FlIOException
Gets next float value in next 32 bits (input only)

Returns:
The float value
Throws:
FlIOException - if an I/O error occurs

nextfloat

public float nextfloat()
                throws FlIOException
Probes next float value in next 32 bits (input only)

Returns:
The float value
Throws:
FlIOException - if an I/O error occurs

getdouble

public double getdouble()
                 throws FlIOException
Gets next double value in next 32 bits (output only)

Returns:
The double value
Throws:
FlIOException - if an I/O error occurs

nextdouble

public double nextdouble()
                  throws FlIOException
Probes next double value in next 32 bits (input only)

Returns:
The double value
Throws:
FlIOException - if an I/O error occurs

putbits

public int putbits(int bits,
                   int n)
            throws FlIOException
Puts 'n' bits (output only)

Parameters:
bits - The value to put
n - The number of bits to put
Returns:
The value put into the bitstream
Throws:
FlIOException - if an I/O error occurs

putfloat

public float putfloat(float f)
               throws FlIOException
Puts float value into next 32 bits (input only)

Parameters:
f - The float value to put
Returns:
The value put into the bit stream
Throws:
FlIOException - if an I/O error occurs

putdouble

public double putdouble(double d)
                 throws FlIOException
Puts double value into next 32 bits (output only)

Parameters:
d - The double value to put
Returns:
value put into the bit stream
Throws:
FlIOException - if an I/O error occurs

little_getbits

public int little_getbits(int n)
                   throws FlIOException
Gets next 'n' bits as unsigned value using the little-endian method (input only)

Parameters:
n - The number of bits to get
Returns:
The value of next n bits
Throws:
FlIOException - if an I/O error occurs

little_sgetbits

public int little_sgetbits(int n)
                    throws FlIOException
Gets next 'n' bits as signed value using the little-endian method (input only)

Parameters:
n - The number of bits to get
Returns:
The value of next n bits
Throws:
FlIOException - if an I/O error occurs

little_nextbits

public int little_nextbits(int n)
                    throws FlIOException
Probes 'n' bits as unsigned value using the little-endian method (input only)

Parameters:
n - The number of bits to get
Returns:
The value of next n bits
Throws:
FlIOException - if an I/O error occurs

little_snextbits

public int little_snextbits(int n)
                     throws FlIOException
Probes 'n' bits as signed value using the little-endian method (input only)

Parameters:
n - The number of bits to get
Returns:
The value of next n bits
Throws:
FlIOException - if an I/O error occurs

little_getfloat

public float little_getfloat()
                      throws FlIOException
Gets next float value in next 32 bits using the little-endian method (input only)

Returns:
The float value
Throws:
FlIOException - if an I/O error occurs

little_nextfloat

public float little_nextfloat()
                       throws FlIOException
Probes next float value in next 32 bits using the little-endian method (input only)

Returns:
The float value
Throws:
FlIOException - if an I/O error occurs

little_getdouble

public double little_getdouble()
                        throws FlIOException
Gets next double value in next 32 bits using the little-endian method (output only)

Returns:
The double value
Throws:
FlIOException - if an I/O error occurs

little_nextdouble

public double little_nextdouble()
                         throws FlIOException
Probes next double value in next 32 bits using the little-endian method (input only)

Returns:
The double value
Throws:
FlIOException - if an I/O error occurs

little_putbits

public int little_putbits(int bits,
                          int n)
                   throws FlIOException
Puts 'n' bits using the little-endian method (output only)

Parameters:
bits - The value to put
n - The number of bits to put
Returns:
The value put into the bitstream
Throws:
FlIOException - if an I/O error occurs

little_putfloat

public float little_putfloat(float f)
                      throws FlIOException
Puts float value into next 32 bits using the little-endian method (input only)

Parameters:
f - The float value to put
Returns:
The value put into the bit stream
Throws:
FlIOException - if an I/O error occurs

little_putdouble

public double little_putdouble(double d)
                        throws FlIOException
Puts double value into next 32 bits using the little-endian method (output only)

Parameters:
d - The double value to put
Returns:
value put into the bit stream
Throws:
FlIOException - if an I/O error occurs

skipbits

public void skipbits(int n)
              throws FlIOException
Skips next 'n' bits (both input/output)

Parameters:
n - The number of bits to skip
Throws:
FlIOException - if an I/O error occurs

align

public int align(int n)
          throws FlIOException
Aligns the bitstream to 8 bit boundary (n must be a multiple of 8, both input/output)

Parameters:
n - The number of bits to align
Returns:
The number of bits skipped
Throws:
FlIOException - if an I/O error occurs or invalid alignment requested

getpos

public int getpos()
Gets current position (both input/output)

Returns:
The current bit position

atend

public boolean atend()
Test end-of-data

Returns:
True when bitsream reaches end-of-data, false otherwise

getmode

public int getmode()
Returns mode(BS_INPUT or BS_OUTPUT)

Returns:
BS_INPUT or BS_OUPUT