protected class ProcessableDetectorOutputStream.WrapperOutputStream extends OutputStream implements DetectorStreamProcessor
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
bytes
An array of buffered bytes or
null. |
private int |
count
The number of bytes buffered in
bytes. |
private OutputStream |
delegate
The delegate adapted by this wrapper.
|
| Constructor and Description |
|---|
WrapperOutputStream(OutputStream outputStream)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
flush() |
private void |
flushBuffer()
This method flushes the internal
buffer. |
void |
process(DetectorStreamBuffer buffer,
Map<String,Object> metadata,
boolean eos)
This method performs the actual detection and optionally manipulates the data.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
private final OutputStream delegate
private byte[] bytes
null.private int count
bytes.public WrapperOutputStream(OutputStream outputStream)
outputStream - is the OutputStream to adapt.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionprivate void flushBuffer()
throws IOException
buffer.IOException - if the underlying OutputStream caused such exception.public void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void process(DetectorStreamBuffer buffer, Map<String,Object> metadata, boolean eos) throws IOException
DetectorStreamProcessorbuffer that provides access to read buffered parts of the stream. As streams are typically larger pieces of
data, this method will be called repetitive in order to process the entire stream. buffer whenever it is invoked.
To ensure your implementation can always make an appropriate decision it may have to ensure a specific
lookahead.process in interface DetectorStreamProcessorbuffer - allows you to read parts of the streamed data as well as to manipulate the data.metadata - is the Map with the meta-data.eos - - true if the end of the stream has been reached and the given buffer has to beIOException - in case of an Input/Output error. Should only be used internally.Copyright © 2001–2016 mmm-Team. All rights reserved.