public abstract class SimpleDecoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends Exception> extends Object implements Decoder<I,O,E>
Decoders that use their own decode thread.| Modifier | Constructor and Description |
|---|---|
protected |
SimpleDecoder(I[] inputBuffers,
O[] outputBuffers) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract I |
createInputBuffer()
Creates a new input buffer.
|
protected abstract O |
createOutputBuffer()
Creates a new output buffer.
|
protected abstract E |
decode(I inputBuffer,
O outputBuffer,
boolean reset)
Decodes the
inputBuffer and stores any decoded output in outputBuffer. |
I |
dequeueInputBuffer()
Dequeues the next input buffer to be filled and queued to the decoder.
|
O |
dequeueOutputBuffer()
Dequeues the next output buffer from the decoder.
|
void |
flush()
Flushes the decoder.
|
void |
queueInputBuffer(I inputBuffer)
Queues an input buffer to the decoder.
|
void |
release()
Releases the decoder.
|
protected void |
releaseOutputBuffer(O outputBuffer)
Releases an output buffer back to the decoder.
|
protected void |
setInitialInputBufferSize(int size)
Sets the initial size of each input buffer.
|
protected final void setInitialInputBufferSize(int size)
This method should only be called before the decoder is used (i.e. before the first call to
dequeueInputBuffer().
size - The required input buffer size.public final I dequeueInputBuffer() throws E extends Exception
DecoderdequeueInputBuffer in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends Exception>E - If a decoder error has occurred.E extends Exceptionpublic final void queueInputBuffer(I inputBuffer) throws E extends Exception
DecoderqueueInputBuffer in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends Exception>inputBuffer - The input buffer.E - If a decoder error has occurred.E extends Exceptionpublic final O dequeueOutputBuffer() throws E extends Exception
DecoderdequeueOutputBuffer in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends Exception>E - If a decoder error has occurred.E extends Exceptionprotected void releaseOutputBuffer(O outputBuffer)
outputBuffer - The output buffer being released.public final void flush()
Decoderflush in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends Exception>public void release()
Decoderrelease in interface Decoder<I extends DecoderInputBuffer,O extends OutputBuffer,E extends Exception>protected abstract I createInputBuffer()
protected abstract O createOutputBuffer()
protected abstract E decode(I inputBuffer, O outputBuffer, boolean reset)
inputBuffer and stores any decoded output in outputBuffer.inputBuffer - The buffer to decode.outputBuffer - The output buffer to store decoded data. The flag
C.BUFFER_FLAG_DECODE_ONLY will be set if the same flag is set on
inputBuffer, but may be set/unset as required. If the flag is set when the call
returns then the output buffer will not be made available to dequeue. The output buffer
may not have been populated in this case.reset - Whether the decoder must be reset before decoding.