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 Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
private 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 OutputStream
IOException
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
public void process(DetectorStreamBuffer buffer, Map<String,Object> metadata, boolean eos) throws IOException
DetectorStreamProcessor
buffer
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 DetectorStreamProcessor
buffer
- 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.