|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.io.InputStream
An InputStream is used to read bytes - however all read() operations will block the current thread. This is not meant to be a replacement for a ewe.io.Stream - rather it is meant to make it easier to port Java applications.
This can be used either as the base class for creating your own InputStream objects, OR it can be used to adapt a Stream object into an InputStream, or adapt a RandomStream object into an InputStream.
| Field Summary | |
protected boolean |
atEOF
|
protected boolean |
closed
|
protected InputStream |
in
The underlying InputStream object - if any. |
protected RandomStream |
rs
The underlying InputStream object - if any. |
protected Stream |
stream
The underlying Stream object - if any. |
| Constructor Summary | |
protected |
InputStream()
|
protected |
InputStream(InputStream in)
|
|
InputStream(RandomStream rs)
|
|
InputStream(Stream stream)
|
| Method Summary | |
int |
available()
Returns the number of bytes that can be read without blocking. |
void |
close()
|
FastStream |
getFastStream()
If the underlying Stream object implements FastStream this method will return that Stream object. |
String |
getName()
Get the name associated with this Streamable object. |
void |
mark(int readLimit)
|
boolean |
markSupported()
|
int |
read()
Reads the next byte of data from this input stream. |
int |
read(byte[] buffer)
Read in a number of bytes of data from the input stream equal to the length of the provided buffer. |
int |
read(byte[] buffer,
int start,
int length)
Read in a number of bytes of data from the input stream. |
protected int |
readSingleByteFromMultiByteRead()
This reads a single byte using the InputStream read(byte[] buffer,int start,int lengh) method. |
void |
reset()
|
void |
shutdown()
This prevents further reads from the InputStream but does not close any underlying IO stream or resource (e.g. |
long |
skip(long toSkip)
Skip over a certain number of bytes. |
Stream |
toReadableStream()
Convert this InputStream to a Stream implementation that allows reading. |
Handle |
toStream(boolean randomStream,
String mode)
Requests the possibly asynchronous creation of a Stream object for reading or writing. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
protected boolean closed
protected boolean atEOF
protected Stream stream
protected InputStream in
protected RandomStream rs
| Constructor Detail |
protected InputStream()
public InputStream(Stream stream)
public InputStream(RandomStream rs)
protected InputStream(InputStream in)
| Method Detail |
public Handle toStream(boolean randomStream,
String mode)
Streamable
toStream in interface StreamablerandomStream - if this is true then a request is being made for
a RandomAccessStream, otherwise either a readable or writable Stream will be returned.mode - For RandomAccessStreams this can be "r" or "rw". For writable Streams this
should be "w" or "a" (for append) and for readable Streams it should be "r".
The calling code should wait on the Handle.Success flag to be set. If this happens the returnValue of the Handle will be set to the acquired Stream. If the Handle fails then the errorObject of the Handle will be set to an IOException.
public String getName()
Streamable
getName in interface Streamable
public void close()
throws IOException
IOException
protected int readSingleByteFromMultiByteRead()
throws IOException
IOException
public int read()
throws IOException
IOException - if an I/O error occured.
public int read(byte[] buffer,
int start,
int length)
throws IOException
buffer - a destination buffer for the data.start - The start offset in the destination buffer.length - The number of bytes to read.
IOException - if an I/O error occurs during reading.
public int read(byte[] buffer)
throws IOException
buffer - a destination buffer for the data.
IOException - if an I/O error occurs during reading.public boolean markSupported()
public void mark(int readLimit)
public void reset()
throws IOException
IOException
public long skip(long toSkip)
throws IOException
toSkip - the number of bytes to skip over.
IOException - if an I/O error occurs while skipping.
public int available()
throws IOException
IOException - if an I/O error occurs.
public void shutdown()
throws IOException
IOExceptionpublic Stream toReadableStream()
public FastStream getFastStream()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||