|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.OutputStream
mediautil.gen.directio.OutStreamToIterativeReader
public class OutStreamToIterativeReader
This class enables writing directly to an IterativeReader which will read the data written as an InputStream. The write calls to this class which is to be used as an OutputStream translate into nextRead() calls on the underlying IterativeReader after buffering. The only catch is that the IterativeReader in this case should not exceed the read request beyond the readCushion as this will result in an empty buffer which will be flagged as an IOException on the IterativeReader's InputStream.
IterativeReader| Constructor Summary | |
|---|---|
OutStreamToIterativeReader()
Creates an OutStreamToIterativeReader Object. |
|
OutStreamToIterativeReader(int bufSize,
int minReadSize,
int readCushion)
Creates an OutStreamToIterativeReader Object. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the OutStreamToIterativeReader. |
InputStream |
getReaderInputStream()
Gets the InputStream for use by the IterativeReader. |
boolean |
isReaderDetached()
Returns if the IterativeReader attached to this OutStreamToIterativeReader has detached. |
void |
setIterativeReader(IterativeReader iterativeReader)
Sets the IterativeReader for this OutStreamToIterativeReader. |
void |
write(byte[] b,
int off,
int len)
Write method of the OutStreamToIterativeReader. |
void |
write(int b)
Write method of the OutStreamToIterativeReader. |
| Methods inherited from class java.io.OutputStream |
|---|
flush, write |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OutStreamToIterativeReader(int bufSize,
int minReadSize,
int readCushion)
bufSize - Buffer SizeminReadSize - Minimum Read request size for the IterativeRead's
nextRead() callreadCushion - Bytes by which the actual bytes read may exceed the
requested number of bytes for the ItertativeReader's nextRead() call. If
the nextRead() call overshoots this limit also then an empty buffer
results which is flagged as an IOException for the reader's InputStream.public OutStreamToIterativeReader()
OutStreamToIterativeReader(int,int,int)| Method Detail |
|---|
public InputStream getReaderInputStream()
ByteCounter and can be cast to a ByteCounter for
the IterativeReader to keep track of the number of bytes read.setIterativeReader(IterativeReader)public void setIterativeReader(IterativeReader iterativeReader)
iterativeReader - IterativeReader to call to read data. The
iterativeReader must write to the InputStream got by the
getReaderInputStream() call.getReaderInputStream()
public void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOException - If the nextRead() call of the iterativeReader
throws an IOExceptionIterativeReader.nextRead(int)
public void write(int b)
throws IOException
write in class OutputStreamIOException - If the nextRead() call of the iterativeReader
throws an IOExceptionIterativeReader.nextRead(int)
public void close()
throws IOException
close in interface Closeableclose in class OutputStreamIOException - If the nextRead() call of the iterativeReader
throws an IOExceptionIterativeReader.nextRead(int)public boolean isReaderDetached()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||