|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface DataSource
This interface defines a source for data, i.e. something that data can be read from.
An InputStream can be adapted to a data source using the
InputStreamToDataSourceAdapter.
| Method Summary | |
|---|---|
int |
available()
Returns an estimate of the number of bytes that can be read from this data source without blocking by the next invocation of a method for this data source. |
void |
close()
Close the source and free all resources associated with it. |
int |
read()
Read a byte of data from the source. |
int |
read(byte[] barr)
Read up to b.length bytes of data from the source into the array. |
int |
read(byte[] barr,
int off,
int len)
Read up to len bytes of data from the source into the array. |
long |
skipBytes(long n)
Attempt to skip over n bytes in the source. |
| Method Detail |
|---|
int available()
throws IllegalStateException,
WrappedIOException
IllegalStateException - If the source is closed.
WrappedIOException - On I/O errors.InputStream.available()
int read()
throws IllegalStateException,
WrappedIOException
0x00-0x0ff).
-1 if the end of the source has
been reached.
IllegalStateException - If the source is closed.
WrappedIOException - On I/O errors.
int read(byte[] barr)
throws IllegalStateException,
WrappedIOException
b.length bytes of data from the source into the array.
barr - The byte array into which data is read.
-1 if
no data could be read because the the end of the source was reached
before the read started.
IllegalStateException - If the source is closed.
WrappedIOException - On I/O errors.
int read(byte[] barr,
int off,
int len)
throws IllegalStateException,
WrappedIOException
len bytes of data from the source into the array.
barr - The byte array into which data is read.off - The start offset in the array b at which data is
written.len - The maximum number of bytes to read.
-1 if
no data could be read because the end of the source was reached before
the read started.
IllegalStateException - If the source is closed.
WrappedIOException - On I/O errors.
long skipBytes(long n)
throws IllegalStateException
n bytes in the source. If n is
negative, no bytes are skipped.
The pointer in the source cannot be moved beyond EOF using this method
(unlike RandomAccess.seek(long)).
n - The number of bytes to increment the source pointer with.
IllegalStateException - If the source is closed.RandomAccess.seek(long)
void close()
throws WrappedIOException
WrappedIOException - On I/O errors.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||