ewe.io
Class PartialOutputStream
java.lang.Object
ewe.util.Errorable
ewe.io.BasicStreamObject
ewe.io.StreamObject
ewe.io.StreamAdapter
ewe.io.PartialOutputStream
- All Implemented Interfaces:
- BasicStream, BufferedStream, Stream, Streamable, StreamCanPause
- public class PartialOutputStream
- extends StreamAdapter
This class is used to create a "sub-stream" of data int another Stream. The
partial stream can limit the amount of data which can be written to the original
Stream. Note the following:
1. Calling close() on a PartialOutputStream does not close the original stream.
2. Setting a limit of -1 will not impose any limit on the number of bytes which
can be read.
3. Input begins at the current point in the source input stream.
|
Method Summary |
boolean |
closeStream()
This will not close the underlying stream. |
boolean |
isOpen()
Returns if the stream is open or not. |
int |
nonBlockingRead(byte[] buff,
int start,
int length)
This calls the nonBlockingRead() of the client BasicStream. |
int |
nonBlockingWrite(byte[] buff,
int offset,
int count)
This calls the nonBlockingWrite() of the client BasicStream. |
boolean |
pushback(byte[] bytes,
int start,
int count)
Push back some bytes into the input stream. |
| Methods inherited from class ewe.io.StreamObject |
close, doRead, doWrite, flush, nap, nap, read, readAByte, readBytes, readBytes, write, writeAByte, writeBytes, writeBytes |
| Methods inherited from interface ewe.io.Stream |
flush, read, read, read, readBytes, readBytes, toInputStream, toOutputStream, write, write, write, writeBytes, writeBytes |
PartialOutputStream
public PartialOutputStream(BasicStream output)
- Creates a new PartialOutputStream with no limit.
PartialOutputStream
public PartialOutputStream(BasicStream output,
int limit)
- Creates a new PartialOutputStream with the specified limit. If the limit
is -1, then there will be no limit imposed
PartialOutputStream
public PartialOutputStream(RandomAccessStream raf,
int start,
int limit)
nonBlockingRead
public int nonBlockingRead(byte[] buff,
int start,
int length)
- Description copied from class:
StreamAdapter
- This calls the nonBlockingRead() of the client BasicStream.
- Specified by:
nonBlockingRead in interface BasicStream- Overrides:
nonBlockingRead in class StreamAdapter
nonBlockingWrite
public int nonBlockingWrite(byte[] buff,
int offset,
int count)
- Description copied from class:
StreamAdapter
- This calls the nonBlockingWrite() of the client BasicStream.
- Specified by:
nonBlockingWrite in interface BasicStream- Overrides:
nonBlockingWrite in class StreamAdapter
closeStream
public boolean closeStream()
throws IOException
- This will not close the underlying stream.
- Specified by:
closeStream in interface BasicStream- Overrides:
closeStream in class StreamAdapter
- Throws:
IOException
isOpen
public boolean isOpen()
- Description copied from interface:
BasicStream
- Returns if the stream is open or not.
- Specified by:
isOpen in interface BasicStream- Overrides:
isOpen in class StreamAdapter
pushback
public boolean pushback(byte[] bytes,
int start,
int count)
- Description copied from class:
StreamAdapter
- Push back some bytes into the input stream. There is no limit on the
number of bytes which can be pushed back. This can be called multiple
times.
- Specified by:
pushback in interface BufferedStream- Overrides:
pushback in class StreamAdapter