|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.io.OutputStream
An OutputStream is used to write bytes - however all write 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 OutputStream objects, OR it can be used to adapt a Stream object into an OutputStream.
| Field Summary | |
protected boolean |
closed
|
protected OutputStream |
out
|
protected RandomStream |
rs
|
protected Stream |
stream
|
| Constructor Summary | |
protected |
OutputStream()
|
protected |
OutputStream(OutputStream out)
|
|
OutputStream(RandomStream rs)
|
|
OutputStream(Stream stream)
|
| Method Summary | |
void |
close()
|
void |
flush()
|
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 |
shutdown()
Shutdown the stream but do not close any underlying IO stream. |
Handle |
toStream(boolean randomStream,
String mode)
Requests the possibly asynchronous creation of a Stream object for reading or writing. |
Stream |
toWritableStream()
Convert this OutputStream to a Stream implementation that allows writing. |
void |
write(byte[] buffer)
Write a number of bytes of data to the output stream equal to the length of the provided buffer. |
void |
write(byte[] buffer,
int start,
int length)
Write a number of bytes of data to the output stream. |
void |
write(int value)
Writes a single byte to the stream. |
protected void |
writeSingleByteToMultiByteWrite(int value)
This writes a single byte using the OutputStream write(byte[] buffer,int start,int lengh) method. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
protected Stream stream
protected RandomStream rs
protected OutputStream out
protected boolean closed
| Constructor Detail |
protected OutputStream()
public OutputStream(Stream stream)
public OutputStream(RandomStream rs)
protected OutputStream(OutputStream out)
| 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
public void flush()
throws IOException
IOException
public void shutdown()
throws IOException
IOException - on error.
protected void writeSingleByteToMultiByteWrite(int value)
throws IOException
IOException
public void write(int value)
throws IOException
IOException - if an I/O error occured.
public void write(byte[] buffer,
int start,
int length)
throws IOException
buffer - the source buffer for the data.start - The start offset in the buffer.length - The number of bytes to write.
IOException - if an I/O error occurs during writing.
public void write(byte[] buffer)
throws IOException
buffer - the source buffer for the data.
IOException - if an I/O error occurs during writing.public Stream toWritableStream()
public FastStream getFastStream()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||