|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface BitStream
Abstract sequential bit-input/output.
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_STREAM_NAME
Default file name. |
static java.lang.String |
STREAM_NAME
Stream-name property (String): file-name etc. |
Fields inherited from interface cz.cuni.jagrlib.iface.Property |
---|
LOGGING, STATISTICS, TEXT_DESCRIPTION |
Method Summary | |
---|---|
long |
available()
How many bits are available to read (or skip). |
boolean |
canRead()
Stream is able to read data. |
void |
close()
Stream close. |
void |
flush()
Stream flush. |
java.io.InputStream |
getInputStream()
Retrieves the associated input stream (non-mandatory). |
java.io.OutputStream |
getOutputStream()
Retrieves the associated output stream (non-mandatory). |
void |
open(boolean output,
java.lang.String name,
java.lang.String detail)
Stream initialization. |
long |
position()
Actual stream position in bits. |
long |
read(int length)
Reads a bunch of bits from the stream. |
void |
readBytes(byte[] data,
int start,
int length)
Reads a bunch of bytes from the stream. |
void |
reOpen(boolean output,
java.lang.String detail)
Stream re-initialization. |
long |
seek(long pos)
Sets actual position of the stream in bits. |
long |
skip(long length)
Skips the given number of bits. |
void |
write(long bits,
int length)
Writes a bunch of bits into the stream. |
void |
writeBytes(byte[] data,
int start,
int length)
Writes a bunch of bytes into the stream. |
Methods inherited from interface cz.cuni.jagrlib.iface.Property |
---|
commit, get, set |
Field Detail |
---|
static final java.lang.String STREAM_NAME
static final java.lang.String DEFAULT_STREAM_NAME
Method Detail |
---|
boolean canRead()
true
, stream can be opened automatically in the init-phase.
void open(boolean output, java.lang.String name, java.lang.String detail) throws java.io.IOException
output
- Open for output?name
- Stream name (either stream identification e.g. file-name). null
for implicit bit-stream (reOpen(boolean, java.lang.String)
).detail
- Further implementation-specific information.
java.io.IOException
reOpen(boolean, java.lang.String)
void reOpen(boolean output, java.lang.String detail) throws java.io.IOException
output
- Open for output?detail
- Further implementation-specific information.
java.io.IOException
open(boolean, java.lang.String, java.lang.String)
java.io.OutputStream getOutputStream()
OutputStream
instance or null
if
not implemented.getInputStream()
java.io.InputStream getInputStream()
InputStream
instance or null
if
not implemented.getOutputStream()
void flush() throws java.io.IOException
java.io.IOException
open(boolean, java.lang.String, java.lang.String)
,
close()
void close() throws java.io.IOException
java.io.IOException
open(boolean, java.lang.String, java.lang.String)
,
reOpen(boolean, java.lang.String)
long position() throws java.io.IOException
java.io.IOException
available()
,
seek(long)
long available() throws java.io.IOException
java.io.IOException
position()
,
seek(long)
long seek(long pos) throws java.io.IOException
pos
- Required stream position in bits.
-1L
if not implemented).
java.io.IOException
position()
void write(long bits, int length) throws java.io.IOException
bits
- Bits to be written (LSB first).length
- Number of bits to write (negative lengths are ignored).
java.io.IOException
writeBytes(byte[], int, int)
,
read(int)
void writeBytes(byte[] data, int start, int length) throws java.io.IOException
data
- Bytes to be written (each byte is written in "LSB first" order).start
- First index to write. Must be less than data.length
.length
- Number of bytes to write (start + length > data.length
is ignored).
java.io.IOException
write(long, int)
,
readBytes(byte[], int, int)
long read(int length) throws java.io.IOException
length
- Number of bits to read (negative lengths are ignored).
java.io.IOException
readBytes(byte[], int, int)
,
write(long, int)
void readBytes(byte[] data, int start, int length) throws java.io.IOException
data
- Array holding the read bytes (each byte is read in "LSB first" order).start
- First index to read. Must be less than data.length
.length
- Number of bytes to read (start + length > data.length
is ignored).
java.io.IOException
read(int)
,
writeBytes(byte[], int, int)
long skip(long length) throws java.io.IOException
length
- Number of bits to skip (negative lengths are ignored).
java.io.IOException
read(int)
,
seek(long)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |