|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.columbia.ee.flavor.Bitstream
Implementation of class to access a bitstream.
Field Summary | |
protected byte[] |
buf
|
protected int |
buf_len
|
static int |
BUF_LEN
|
protected boolean |
close_fd
|
static int[] |
cmask
|
protected int |
cur_bit
|
protected boolean |
eof
|
protected java.io.InputStream |
in
|
static long |
LONG_SIGN
|
static int[] |
mask
|
static int |
MAX_SIZE_OF_BITS
|
protected java.io.OutputStream |
out
|
static int[] |
smask
|
protected int |
total_bits
|
protected int |
type
|
Fields inherited from interface edu.columbia.ee.flavor.IBitstream |
BS_INPUT, BS_OUTPUT |
Constructor Summary | |
Bitstream(java.io.InputStream input)
Constructs input bitstream. |
|
Bitstream(java.io.InputStream input,
int _buf_len)
Constructs input bitstream with the given buffer length. |
|
Bitstream(java.io.OutputStream output)
Constructs output bitstream. |
|
Bitstream(java.io.OutputStream output,
int _buf_len)
Constructs an output bitstream with the given buffer length. |
|
Bitstream(java.lang.String filename,
int _type)
Constructs either an output or an input stream, depending on the type |
|
Bitstream(java.lang.String filename,
int _type,
int _buf_len)
Constructs either an output or an input stream, depending on the type, with the given buffer length. |
Method Summary | |
int |
align(int n)
Align bitstream |
boolean |
atend()
Check eof-of-file flag |
void |
close()
close file |
protected void |
finalize()
close opened files |
void |
flushbits()
Flush all content in the buffer |
int |
getbits(int n)
Get next n bits |
int |
getCurrentBit()
Return current bit position |
double |
getdouble()
Get double value(64 bits) from bistream |
float |
getfloat()
Get float value(32 bits) from the bistream |
int |
getmode()
Return mode(BS_INPUT or BS_OUTPUT) |
int |
getpos()
Current bit position |
int |
little_getbits(int n)
Gets bits in little order. |
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 y,
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) |
static void |
main(java.lang.String[] args)
|
int |
nextbits(int n)
Peek next n bits |
double |
nextdouble()
Get next double value from bistream |
float |
nextfloat()
Peak float value(32 bits) from the bistream |
int |
putbits(int y,
int n)
Put n bits |
double |
putdouble(double d)
Put a double value into bitstream |
float |
putfloat(float f)
Put float value(32 bits) into bistream |
int |
sgetbits(int n)
Get next n bits Java does not support unsigned type Remains only for compatibility with C++ language Blindly calls sgetbits |
void |
skipbits(int n)
Skip n bits |
int |
snextbits(int n)
Peek next n bits - signed value |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BUF_LEN
public static long LONG_SIGN
public static int MAX_SIZE_OF_BITS
public static final int[] mask
public static final int[] cmask
public static final int[] smask
protected boolean close_fd
protected int buf_len
protected byte[] buf
protected int cur_bit
protected int total_bits
protected boolean eof
protected java.io.InputStream in
protected java.io.OutputStream out
protected int type
Constructor Detail |
public Bitstream(java.io.InputStream input) throws FlIOException
input
-
FlIOException
public Bitstream(java.io.OutputStream output) throws FlIOException
output
-
FlIOException
public Bitstream(java.io.InputStream input, int _buf_len) throws FlIOException
input
- _buf_len
-
FlIOException
public Bitstream(java.io.OutputStream output, int _buf_len) throws FlIOException
output
- _buf_len
-
FlIOException
public Bitstream(java.lang.String filename, int _type) throws FlIOException
filename
- file name to open_type
- I/O type( BS_INPUT or BS_OUTPUT )
FlIOException
public Bitstream(java.lang.String filename, int _type, int _buf_len) throws FlIOException
filename
- file name to open_type
- I/O type( BS_INPUT or BS_OUTPUT )_buf_len
- buffer size
FlIOException
Method Detail |
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
Object.finalize()
public void close() throws FlIOException
FlIOException
public boolean atend()
atend
in interface IBitstream
true
if at end of filepublic int getpos()
getpos
in interface IBitstream
public int getbits(int n) throws FlIOException
getbits
in interface IBitstream
n
- number of bits to be fetched
FlIOException
- when n > 32public int sgetbits(int n) throws FlIOException
sgetbits
in interface IBitstream
n
- The number of bits to get
FlIOException
- if an I/O error occursthrows FlIOException
public int nextbits(int n) throws FlIOException
nextbits
in interface IBitstream
n
- number of bits to peek
FlIOException
- when n > 32
eof-of-file
not enough datapublic int snextbits(int n) throws FlIOException
snextbits
in interface IBitstream
n
- number of bits to peek
FlIOException
- when n > 32
eof-of-file
not enough datapublic float getfloat() throws FlIOException
getfloat
in interface IBitstream
FlIOException
public float nextfloat() throws FlIOException
nextfloat
in interface IBitstream
FlIOException
public double getdouble() throws FlIOException
getdouble
in interface IBitstream
FlIOException
public double nextdouble() throws FlIOException
nextdouble
in interface IBitstream
FlIOException
public int putbits(int y, int n) throws FlIOException
putbits
in interface IBitstream
y
- value to putn
- number of bits to put ( <= 32 bits)
y
FlIOException
public float putfloat(float f) throws FlIOException
putfloat
in interface IBitstream
f
- float value
FlIOException
public double putdouble(double d) throws FlIOException
putdouble
in interface IBitstream
d
- double variable
FlIOException
- if putbits() failspublic int little_getbits(int n) throws FlIOException
little_getbits
in interface IBitstream
n
- bits to get
FlIOException
public int little_sgetbits(int n) throws FlIOException
IBitstream
little_sgetbits
in interface IBitstream
n
- The number of bits to get
FlIOException
- if an I/O error occurspublic int little_nextbits(int n) throws FlIOException
IBitstream
little_nextbits
in interface IBitstream
n
- The number of bits to get
FlIOException
- if an I/O error occurspublic int little_snextbits(int n) throws FlIOException
IBitstream
little_snextbits
in interface IBitstream
n
- The number of bits to get
FlIOException
- if an I/O error occurspublic float little_getfloat() throws FlIOException
IBitstream
little_getfloat
in interface IBitstream
FlIOException
- if an I/O error occurspublic float little_nextfloat() throws FlIOException
IBitstream
little_nextfloat
in interface IBitstream
FlIOException
- if an I/O error occurspublic double little_getdouble() throws FlIOException
IBitstream
little_getdouble
in interface IBitstream
FlIOException
- if an I/O error occurspublic double little_nextdouble() throws FlIOException
IBitstream
little_nextdouble
in interface IBitstream
FlIOException
- if an I/O error occurspublic int little_putbits(int y, int n) throws FlIOException
IBitstream
little_putbits
in interface IBitstream
y
- The value to putn
- The number of bits to put
FlIOException
- if an I/O error occurspublic float little_putfloat(float f) throws FlIOException
IBitstream
little_putfloat
in interface IBitstream
f
- The float value to put
FlIOException
- if an I/O error occurspublic double little_putdouble(double d) throws FlIOException
IBitstream
little_putdouble
in interface IBitstream
d
- The double value to put
FlIOException
- if an I/O error occurspublic void skipbits(int n) throws FlIOException
skipbits
in interface IBitstream
n
- number of bits to skip
FlIOException
public int align(int n) throws FlIOException
align
in interface IBitstream
n
- number of bits to align on
FlIOException
public void flushbits() throws FlIOException
FlIOException
public int getCurrentBit()
public static void main(java.lang.String[] args)
public int getmode()
getmode
in interface IBitstream
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |