|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object org.jboss.netty.handler.codec.embedder.EncoderEmbedder<E>
public class EncoderEmbedder<E>
A helper that wraps an encoder so that it can be used without doing actual
I/O in unit tests or higher level codecs. For example, you can encode a
String
into a Base64-encoded ChannelBuffer
with
Base64Encoder
and StringEncoder
without setting up the
ChannelPipeline
and other mock objects by yourself:
String data = "foobar";EncoderEmbedder
<ChannelBuffer
> embedder = newEncoderEmbedder
<ChannelBuffer
>( newBase64Encoder
(), newStringEncoder
()); embedded.offer(data);ChannelBuffer
encoded = embedded.poll(); assert encoded.toString(CharsetUtil
.US_ASCII).equals("Zm9vYmFy");
DecoderEmbedder
构造方法摘要 | |
---|---|
EncoderEmbedder(ChannelBufferFactory bufferFactory,
ChannelDownstreamHandler... handlers)
Creates a new embedder whose pipeline is composed of the specified handlers. |
|
EncoderEmbedder(ChannelDownstreamHandler... handlers)
Creates a new embedder whose pipeline is composed of the specified handlers. |
方法摘要 | ||
---|---|---|
boolean |
finish()
Signals the pipeline that the encoding or decoding has been finished and no more data will be offered. |
|
boolean |
offer(java.lang.Object input)
Offers an input object to the pipeline of this embedder. |
|
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. |
|
|
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. |
从类 java.lang.Object 继承的方法 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造方法详细信息 |
---|
public EncoderEmbedder(ChannelDownstreamHandler... handlers)
public EncoderEmbedder(ChannelBufferFactory bufferFactory, ChannelDownstreamHandler... handlers)
bufferFactory
- the ChannelBufferFactory
to be used when
creating a new buffer.方法详细信息 |
---|
public boolean offer(java.lang.Object input)
CodecEmbedder
复制的描述
true
if and only if there is something to read in the
product queue (see CodecEmbedder.poll()
and CodecEmbedder.peek()
)public boolean finish()
CodecEmbedder
复制的描述
CodecEmbedder<E>
中的 finish
true
if and only if there is something to read in the
product queue (see CodecEmbedder.poll()
and CodecEmbedder.peek()
)public final E poll()
CodecEmbedder
复制的描述
CodecEmbedder<E>
中的 poll
null
if and only if there is no output object left in the
product queue.public final E peek()
CodecEmbedder
复制的描述CodecEmbedder.poll()
is that it does not remove the
retrieved object from the product queue.
CodecEmbedder<E>
中的 peek
null
if and only if there is no output object left in the
product queue.public final java.lang.Object[] pollAll()
CodecEmbedder
复制的描述Collection.toArray()
except that
the product queue is cleared.
CodecEmbedder<E>
中的 pollAll
public final <T> T[] pollAll(T[] a)
CodecEmbedder
复制的描述Collection.toArray(Object[])
except that the product queue is cleared.
CodecEmbedder<E>
中的 pollAll
public final int size()
CodecEmbedder
复制的描述
CodecEmbedder<E>
中的 size
|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |