Interface CodecEmbedder<E>
-
- All Known Implementing Classes:
AbstractCodecEmbedder,DecoderEmbedder,EncoderEmbedder
public interface CodecEmbedder<E>A helper that wraps an encoder or a decoder (codec) so that they can be used without doing actual I/O in unit tests or higher level codecs. Please refer toEncoderEmbedderandDecoderEmbedderfor more information.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanfinish()Signals the pipeline that the encoding or decoding has been finished and no more data will be offered.ChannelPipelinegetPipeline()Returns theChannelPipelinethat handles the input.booleanoffer(java.lang.Object input)Offers an input object to the pipeline of this embedder.Epeek()Reads an encoded or decoded output from the head of the product queue.Epoll()Consumes an encoded or decoded output from the product queue.java.lang.Object[]pollAll()Consumes all encoded or decoded output from the product queue.<T> T[]pollAll(T[] a)Consumes all encoded or decoded output from the product queue.intsize()Returns the number of encoded or decoded output in the product queue.
-
-
-
Method Detail
-
offer
boolean offer(java.lang.Object input)
Offers an input object to the pipeline of this embedder.
-
finish
boolean finish()
Signals the pipeline that the encoding or decoding has been finished and no more data will be offered.
-
poll
E poll()
Consumes an encoded or decoded output from the product queue. The output object is generated by the offered input objects.- Returns:
- an encoded or decoded object.
nullif and only if there is no output object left in the product queue.
-
peek
E peek()
Reads an encoded or decoded output from the head of the product queue. The difference frompoll()is that it does not remove the retrieved object from the product queue.- Returns:
- an encoded or decoded object.
nullif and only if there is no output object left in the product queue.
-
pollAll
java.lang.Object[] pollAll()
Consumes all encoded or decoded output from the product queue. The output object is generated by the offered input objects. The behavior of this method is identical withCollection.toArray()except that the product queue is cleared.- Returns:
- an array of all encoded or decoded objects. An empty array is returned if and only if there is no output object left in the product queue.
-
pollAll
<T> T[] pollAll(T[] a)
Consumes all encoded or decoded output from the product queue. The output object is generated by the offered input objects. The behavior of this method is identical withCollection.toArray(Object[])except that the product queue is cleared.- Returns:
- an array of all encoded or decoded objects. An empty array is returned if and only if there is no output object left in the product queue.
-
size
int size()
Returns the number of encoded or decoded output in the product queue.
-
getPipeline
ChannelPipeline getPipeline()
Returns theChannelPipelinethat handles the input.
-
-