|
||||||||||
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 String |
DEFAULT_STREAM_NAME
Default file name. |
static 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. |
InputStream |
getInputStream()
Retrieves the associated input stream (non-mandatory). |
OutputStream |
getOutputStream()
Retrieves the associated output stream (non-mandatory). |
void |
open(boolean output,
String name,
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,
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 String STREAM_NAME
static final String DEFAULT_STREAM_NAME
Method Detail |
---|
boolean canRead()
true
, stream can be opened automatically in the init-phase.
void open(boolean output, String name, String detail) throws 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.
IOException
reOpen(boolean, java.lang.String)
void reOpen(boolean output, String detail) throws IOException
output
- Open for output?detail
- Further implementation-specific information.
IOException
open(boolean, java.lang.String, java.lang.String)
OutputStream getOutputStream()
OutputStream
instance or null
if
not implemented.getInputStream()
InputStream getInputStream()
InputStream
instance or null
if
not implemented.getOutputStream()
void flush() throws IOException
IOException
open(boolean, java.lang.String, java.lang.String)
,
close()
void close() throws IOException
IOException
open(boolean, java.lang.String, java.lang.String)
,
reOpen(boolean, java.lang.String)
long position() throws IOException
IOException
available()
,
seek(long)
long available() throws IOException
IOException
position()
,
seek(long)
long seek(long pos) throws IOException
pos
- Required stream position in bits.
-1L
if not implemented).
IOException
position()
void write(long bits, int length) throws IOException
bits
- Bits to be written (LSB first).length
- Number of bits to write (negative lengths are ignored).
IOException
writeBytes(byte[], int, int)
,
read(int)
void writeBytes(byte[] data, int start, int length) throws 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).
IOException
write(long, int)
,
readBytes(byte[], int, int)
long read(int length) throws IOException
length
- Number of bits to read (negative lengths are ignored).
IOException
readBytes(byte[], int, int)
,
write(long, int)
void readBytes(byte[] data, int start, int length) throws 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).
IOException
read(int)
,
writeBytes(byte[], int, int)
long skip(long length) throws IOException
length
- Number of bits to skip (negative lengths are ignored).
IOException
read(int)
,
seek(long)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |