Top Inners Fields Constructors Methods
io.netty5.channel.socket.nio

pack-priv final Class ByteBufferCollector

extends Object
implements Predicate<Object>
Class Inheritance
All Implemented Interfaces
java.util.function.Predicate
Imports
io.netty5.buffer.Buffer, io.netty5.util.concurrent.FastThreadLocal, java.nio.ByteBuffer, java.util.Arrays, java.util.function.Predicate

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
ByteBufferCollector.BufferCache

Thread-local cache of ByteBuffer array, and processing meta-data.

Field Summary

Modifier and TypeField and Description
private ByteBufferCollector.BufferCache
private long
private int
private static final FastThreadLocal<ByteBufferCollector.BufferCache>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static ByteBuffer[]
expandNioBufferArray(ByteBuffer[] array, int neededSpace, int size)

pack-priv int
nioBufferCount()

Returns the number of ByteBuffer that can be written out of the ByteBuffer array that was obtained via test(Object).

pack-priv ByteBuffer[]
pack-priv long
nioBufferSize()

Returns the number of bytes that can be written out of the ByteBuffer array that was obtained via test(Object).

pack-priv void
prepare(int
The maximum amount of buffers that will be added to the return value.
maxCount
,
long
A hint toward the maximum number of bytes to include as part of the return value. Note that this value maybe exceeded because we make a best effort to include at least 1 ByteBuffer in the return value to ensure write progress is made.
maxBytes
)

Returns an array of direct NIO buffers if the currently pending messages are made of Buffer only.

pack-priv void
public boolean
test(Object
the input argument
msg
)

Implements java.util.function.Predicate.test.

Evaluates this predicate on the given argument.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheback to summary
private ByteBufferCollector.BufferCache cache
maxBytesback to summary
private long maxBytes
maxCountback to summary
private int maxCount
NIO_BUFFERSback to summary
private static final FastThreadLocal<ByteBufferCollector.BufferCache> NIO_BUFFERS

Constructor Detail

ByteBufferCollectorback to summary
pack-priv ByteBufferCollector()

Method Detail

expandNioBufferArrayback to summary
private static ByteBuffer[] expandNioBufferArray(ByteBuffer[] array, int neededSpace, int size)
nioBufferCountback to summary
pack-priv int nioBufferCount()

Returns the number of ByteBuffer that can be written out of the ByteBuffer array that was obtained via test(Object). This method MUST be called after test(Object) was called.

nioBuffersback to summary
pack-priv ByteBuffer[] nioBuffers()
nioBufferSizeback to summary
pack-priv long nioBufferSize()

Returns the number of bytes that can be written out of the ByteBuffer array that was obtained via test(Object). This method MUST be called after test(Object) was called.

prepareback to summary
pack-priv void prepare(int maxCount, long maxBytes)

Returns an array of direct NIO buffers if the currently pending messages are made of Buffer only. nioBufferCount() and nioBufferSize() will return the number of NIO buffers in the returned array and the total number of readable bytes of the NIO buffers respectively.

Parameters
maxCount:int

The maximum amount of buffers that will be added to the return value.

maxBytes:long

A hint toward the maximum number of bytes to include as part of the return value. Note that this value maybe exceeded because we make a best effort to include at least 1 ByteBuffer in the return value to ensure write progress is made.

resetback to summary
pack-priv void reset()
testback to summary
public boolean test(Object msg) throws RuntimeException

Implements java.util.function.Predicate.test.

Doc from java.util.function.Predicate.test.

Evaluates this predicate on the given argument.

Parameters
msg:Object

the input argument

Returns:boolean

true if the input argument matches the predicate, otherwise false

Annotations
@Override
io.netty5.channel.socket.nio back to summary

private final Class ByteBufferCollector.BufferCache

extends Object
Class Inheritance

Thread-local cache of ByteBuffer array, and processing meta-data.

Field Summary

Modifier and TypeField and Description
pack-priv int
pack-priv ByteBuffer[]
pack-priv long

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferCountback to summary
pack-priv int bufferCount
buffersback to summary
pack-priv ByteBuffer[] buffers
totalSizeback to summary
pack-priv long totalSize

Constructor Detail

BufferCacheback to summary
private BufferCache()