@UnstableApi
public abstract class AbstractCoalescingBufferQueue
extends java.lang.Object | Modifier | Constructor and Description |
|---|---|
protected |
AbstractCoalescingBufferQueue(Channel channel, int initSize)
创建一个新的实例。
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(ByteBuf buf)
在队列的末尾添加一个缓冲区。
|
void |
add(ByteBuf buf, ChannelFutureListener listener)
将一个缓冲区添加到队列的末尾,并将一个侦听器与它关联起来,当所有缓冲区字节已从队列中消耗并写入时应该完成侦听器。
|
void |
add(ByteBuf buf, ChannelPromise promise)
将一个缓冲区添加到队列的末尾,并将一个承诺与它关联起来,当所有缓冲区的字节已从队列中消耗并写入时应该完成该承诺。
|
void |
addFirst(ByteBuf buf, ChannelPromise promise)
将一个缓冲区添加到队列的前面,并将一个承诺与它关联起来,当所有缓冲区的字节已从队列中消耗并写入时应该完成该承诺。
|
protected abstract ByteBuf |
compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next)
计算
current + next的结果。
|
protected ByteBuf |
composeFirst(ByteBufAllocator allocator, ByteBuf first)
计算第一个 ByteBuf ,将在随后致电compose(ByteBufAllocator, ByteBuf, ByteBuf)时使用 。
|
protected ByteBuf |
composeIntoComposite(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next)
将 cumulation和next成一个新的CompositeByteBuf 。
|
protected ByteBuf |
copyAndCompose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next)
|
void |
copyTo(AbstractCoalescingBufferQueue dest)
将此队列中的所有待处理条目复制到目标队列中。
|
boolean |
isEmpty()
队列中是否有挂起的缓冲区。
|
int |
readableBytes()
可读字节数。
|
void |
releaseAndFailAll(ChannelOutboundInvoker invoker, java.lang.Throwable cause)
释放队列中的所有缓冲区并完成所有侦听器和承诺。
|
ByteBuf |
remove(ByteBufAllocator alloc, int bytes, ChannelPromise aggregatePromise)
用指定的字节数从队列中删除 ByteBuf 。
|
protected abstract ByteBuf |
removeEmptyValue()
调用
remove(ByteBufAllocator, int, ChannelPromise)时返回的值,但队列为空。
|
ByteBuf |
removeFirst(ChannelPromise aggregatePromise)
从队列中移除第一个 ByteBuf 。
|
protected int |
size()
获取此队列中通过
add(ByteBuf)方法之一添加的元素数量。
|
void |
writeAndRemoveAll(ChannelHandlerContext ctx)
将所有剩余的元素写入此队列中。
|
protected AbstractCoalescingBufferQueue(Channel channel, int initSize)
channel -所述Channel ,其将具有Channel.isWritable()反映排队缓冲器的量或null如果更新没有可写状态。
initSize - 基础队列的初始大小。
public final void addFirst(ByteBuf buf, ChannelPromise promise)
buf - 添加到队列的头部
promise - 当所有字节被消耗和写入时完成,可以是无效的。
public final void add(ByteBuf buf)
public final void add(ByteBuf buf, ChannelPromise promise)
buf - 添加到队列尾部
promise - 在所有字节被消耗和写入时完成,可以是无效的。
public final void add(ByteBuf buf, ChannelFutureListener listener)
buf - 添加到队列尾部
listener - 通知所有字节已被使用和写入时,可以是
null 。
public final ByteBuf removeFirst(ChannelPromise aggregatePromise)
ByteBuf 。
aggregatePromise - 用于聚合返回缓冲区的承诺和侦听器。
ByteBuf 。
public final ByteBuf remove(ByteBufAllocator alloc, int bytes, ChannelPromise aggregatePromise)
ByteBuf 。
任何添加的字节缓冲区在删除过程中会被完全消耗,当传递的聚合ChannelPromise完成时,它将承诺完成。
alloc - 如果在聚合过程中生成新的ByteBuf,则使用分配器。
bytes -返回可读的最大字节数ByteBuf ,如果bytes大于readableBytes接着长度的缓冲器readableBytes被返回。
aggregatePromise - 用于聚合组成缓冲区的承诺和侦听器。
ByteBuf 。
public final int readableBytes()
public final boolean isEmpty()
public final void releaseAndFailAll(ChannelOutboundInvoker invoker, java.lang.Throwable cause)
public final void copyTo(AbstractCoalescingBufferQueue dest)
dest - 将待处理的缓冲区复制到。
public final void writeAndRemoveAll(ChannelHandlerContext ctx)
ctx - 将所有元素写入的上下文。
protected abstract ByteBuf compose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next)
current + next的结果。
protected final ByteBuf composeIntoComposite(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next)
cumulation和next成一个新的CompositeByteBuf 。
protected final ByteBuf copyAndCompose(ByteBufAllocator alloc, ByteBuf cumulation, ByteBuf next)
alloc - 用于分配新缓冲区的分配器。
cumulation - 当前累计。
next - 下一个缓冲区。
cumulation + next的结果。
protected ByteBuf composeFirst(ByteBufAllocator allocator, ByteBuf first)
ByteBuf ,随后调用compose(ByteBufAllocator, ByteBuf, ByteBuf) 。
protected abstract ByteBuf removeEmptyValue()
remove(ByteBufAllocator, int, ChannelPromise)被调用但队列为空时返回的值。
ByteBuf 。
protected final int size()
add(ByteBuf)方法之一添加的此队列中元素的数量。
Copyright © 2008–2018 The Netty Project. All rights reserved.