protected class ProcessableDetectorInputStream.WrapperInputStream extends InputStream implements DetectorStreamProcessor
| Modifier and Type | Field and Description |
|---|---|
private InputStream |
delegate
The delegate adapted by this wrapper.
|
private boolean |
endOfStream
true if end of detection-stream, false otherwise. |
private DetectorStreamBuffer |
targetBuffer
The destination buffer (end of chain)
|
| Constructor and Description |
|---|
WrapperInputStream(InputStream inputStream)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
fill(int requiredBufferLength)
This method tries to ensure that the internal buffer has at least the given number of bytes available.
|
void |
process(DetectorStreamBuffer buffer,
Map<String,Object> metadata,
boolean eos)
This method performs the actual detection and optionally manipulates the data.
|
int |
read() |
int |
read(byte[] buffer,
int offset,
int length) |
long |
skip(long n) |
available, mark, markSupported, read, resetprivate final InputStream delegate
private DetectorStreamBuffer targetBuffer
private boolean endOfStream
true if end of detection-stream, false otherwise.public WrapperInputStream(InputStream inputStream)
inputStream - is the InputStream to adapt.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] buffer,
int offset,
int length)
throws IOException
read in class InputStreamIOExceptionpublic long skip(long n)
throws IOException
skip in class InputStreamIOExceptionprotected void fill(int requiredBufferLength)
throws IOException
requiredBufferLength - is the desired number of bytes for the buffer.IOException - if an I/O error occurred.public 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.