abstract class AbstractCodecEmbedder<E> extends java.lang.Object implements CodecEmbedder<E>
CodecEmbedder implementation.| Modifier and Type | Class and Description |
|---|---|
private static class |
AbstractCodecEmbedder.EmbeddedChannelPipeline |
private class |
AbstractCodecEmbedder.EmbeddedChannelSink |
| Modifier and Type | Field and Description |
|---|---|
private Channel |
channel |
private ChannelPipeline |
pipeline |
(package private) java.util.Queue<java.lang.Object> |
productQueue |
private AbstractCodecEmbedder.EmbeddedChannelSink |
sink |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractCodecEmbedder(ChannelBufferFactory bufferFactory,
ChannelHandler... handlers)
Creates a new embedder whose pipeline is composed of the specified
handlers.
|
protected |
AbstractCodecEmbedder(ChannelHandler... handlers)
Creates a new embedder whose pipeline is composed of the specified
handlers.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
configurePipeline(ChannelHandler... handlers) |
boolean |
finish()
Signals the pipeline that the encoding or decoding has been finished and
no more data will be offered.
|
private void |
fireInitialEvents() |
protected Channel |
getChannel()
Returns the virtual
Channel which will be used as a mock
during encoding and decoding. |
ChannelPipeline |
getPipeline()
Returns the
ChannelPipeline that handles the input. |
protected boolean |
isEmpty()
|
E |
peek()
Reads an encoded or decoded output from the head of the product queue.
|
E |
poll()
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.
|
int |
size()
Returns the number of encoded or decoded output in the product queue.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitofferprivate final Channel channel
private final ChannelPipeline pipeline
private final AbstractCodecEmbedder.EmbeddedChannelSink sink
final java.util.Queue<java.lang.Object> productQueue
protected AbstractCodecEmbedder(ChannelHandler... handlers)
protected AbstractCodecEmbedder(ChannelBufferFactory bufferFactory, ChannelHandler... handlers)
bufferFactory - the ChannelBufferFactory to be used when
creating a new buffer.private void fireInitialEvents()
private void configurePipeline(ChannelHandler... handlers)
public boolean finish()
CodecEmbedderfinish in interface CodecEmbedder<E>true if and only if there is something to read in the
product queue (see CodecEmbedder.poll() and CodecEmbedder.peek())protected final Channel getChannel()
Channel which will be used as a mock
during encoding and decoding.protected final boolean isEmpty()
public final E poll()
CodecEmbedderpoll in interface CodecEmbedder<E>null if and only if there is no output object left in the
product queue.public final E peek()
CodecEmbedderCodecEmbedder.poll() is that it does not remove the
retrieved object from the product queue.peek in interface CodecEmbedder<E>null if and only if there is no output object left in the
product queue.public final java.lang.Object[] pollAll()
CodecEmbedderCollection.toArray() except that
the product queue is cleared.pollAll in interface CodecEmbedder<E>public final <T> T[] pollAll(T[] a)
CodecEmbedderCollection.toArray(Object[])
except that the product queue is cleared.pollAll in interface CodecEmbedder<E>public final int size()
CodecEmbeddersize in interface CodecEmbedder<E>public ChannelPipeline getPipeline()
CodecEmbedderChannelPipeline that handles the input.getPipeline in interface CodecEmbedder<E>