|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IRandomAccess
An interface for an object that can randomly access bytes in a data stream.
This is an abstraction of RandomAccessFile
to support other data
storage objects (like byte arrays and so on).
Method Summary | |
---|---|
InputStream |
asInputStream()
A InputStream view on the data structure. |
OutputStream |
asOutputStream()
A OutputStream view on the data structure. |
void |
close()
Closes this random access data container and releases any system resources associated with the stream. |
void |
flush()
Force changes to be made persistent. |
long |
getLength()
Returns the length of this data container. |
long |
getOffset()
Returns the current offset in this data container. |
boolean |
isReadOnly()
true if this is a read only data container. |
void |
mark()
Mark the current offset into the data in a stack like manner. |
int |
read()
Reads a byte of data from this data container. |
int |
read(byte[] buffer)
Reads up to buffer.length bytes of data from this data
container into an array of bytes. |
int |
read(byte[] buffer,
int start,
int numBytes)
Reads up to len bytes of data from this data container
into an array of bytes. |
void |
reset()
Reset to the last position on the mark-stack. |
void |
seek(long offset)
Sets the offset, measured from the beginning of the data container at which the next read or write occurs. |
void |
seekBy(long delta)
Sets the offset, measured from the current offset at which the next read or write occurs. |
void |
setLength(long newLength)
Assign the length. |
void |
write(byte[] buffer)
Writes b.length bytes from the specified byte array,
starting at the current offset. |
void |
write(byte[] buffer,
int start,
int numBytes)
Writes len bytes from the specified byte array starting at
start . |
void |
write(int b)
Writes the specified byte . |
Method Detail |
---|
void seek(long offset) throws IOException
offset
- the offset position, measured in bytes from the beginning of
the data container
IOException
- if offset
is less than 0
or
if an I/O error occurs.void seekBy(long delta) throws IOException
delta
- the ammount of bytes by wich to change the current offset
position
IOException
- if the resulting offset
is less than
0
or if an I/O error occurs.int read() throws IOException
0x00-0x0ff
). This method
blocks if no input is yet available.
This method behaves in exactly the same way as the
InputStream.read()
method of InputStream
.
-1
if the end of the
data container has been reached.
IOException
- if an I/O error occurs. Not thrown if the end of the data
container has been reached.long getOffset() throws IOException
IOException
- if an I/O error occurs.long getLength() throws IOException
IOException
- if an I/O error occurs.void setLength(long newLength) throws IOException
newLength
-
IOException
int read(byte[] buffer) throws IOException
buffer.length
bytes of data from this data
container into an array of bytes. This method blocks until at least one
byte of input is available.
This method behaves in the exactly the same way as the
InputStream.read(byte[])
method of InputStream
.
buffer
- the buffer into which the data is read.
-1
if there is no more data because the end of
this data container has been reached.
IOException
- if an I/O error occurs.int read(byte[] buffer, int start, int numBytes) throws IOException
len
bytes of data from this data container
into an array of bytes. This method blocks until at least one byte of
input is available.
b
- the buffer into which the data is read.off
- the start offset of the data.len
- the maximum number of bytes read.
-1
if there is no more data because the end of the
file has been reached.
IOException
- if an I/O error occurs.void close() throws IOException
IOException
- if an I/O error occurs.void flush() throws IOException
IOException
boolean isReadOnly()
true
if this is a read only data container.
true
if this is a read only data container.void write(int b) throws IOException
b
- the byte
to be written.
IOException
- if an I/O error occurs.void write(byte[] buffer) throws IOException
b.length
bytes from the specified byte array,
starting at the current offset.
b
- the data.
IOException
- if an I/O error occurs.void write(byte[] buffer, int start, int numBytes) throws IOException
len
bytes from the specified byte array starting at
start
.
buffer
- the data.start
- the start offset in the data.numBytes
- the number of bytes to write.
IOException
- if an I/O error occurs.InputStream asInputStream()
InputStream
view on the data structure.
InputStream
view on the data structure.OutputStream asOutputStream()
OutputStream
view on the data structure.
OutputStream
view on the data structure.void mark() throws IOException
IOException
void reset() throws IOException
IOException
|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |