public final class IovArray extends java.lang.Object implements ChannelOutboundBuffer.MessageProcessor
man writev
.
struct iovec { void *iov_base; size_t iov_len; };See also Efficient JNI programming IV: Wrapping native data objects.
限定符和类型 | 字段和说明 |
---|---|
static int |
IOV_SIZE
The size of an
iovec struct in bytes. |
限定符和类型 | 方法和说明 |
---|---|
boolean |
add(ByteBuf buf)
已过时。
|
boolean |
add(ByteBuf buf,
int offset,
int len) |
void |
clear() |
int |
count()
Returns the number if iov entries.
|
long |
maxBytes()
Get the maximum amount of bytes that can be added to this
IovArray . |
void |
maxBytes(long maxBytes)
Set the maximum amount of bytes that can be added to this
IovArray via add(ByteBuf, int, int)
This will not impact the existing state of the IovArray , and only applies to subsequent calls to
add(ByteBuf) . |
long |
memoryAddress(int offset)
Returns the
memoryAddress for the given offset . |
boolean |
processMessage(java.lang.Object msg)
Will be called for each flushed message until it either there are no more flushed messages or this
method returns
false . |
void |
release()
Release the
IovArray . |
long |
size()
Returns the size in bytes
|
public static final int IOV_SIZE
iovec
struct in bytes. This is calculated as we have 2 entries each of the size of the
address.public IovArray()
public IovArray(ByteBuf memory)
public void clear()
@Deprecated public boolean add(ByteBuf buf)
add(ByteBuf, int, int)
public boolean add(ByteBuf buf, int offset, int len)
public int count()
public long size()
public void maxBytes(long maxBytes)
IovArray
via add(ByteBuf, int, int)
This will not impact the existing state of the IovArray
, and only applies to subsequent calls to
add(ByteBuf)
.
In order to ensure some progress is made at least one ByteBuf
will be accepted even if it's size exceeds
this value.
maxBytes
- the maximum amount of bytes that can be added to this IovArray
.public long maxBytes()
IovArray
.IovArray
.public long memoryAddress(int offset)
memoryAddress
for the given offset
.public void release()
IovArray
. Once release further using of it may crash the JVM!public boolean processMessage(java.lang.Object msg) throws java.lang.Exception
ChannelOutboundBuffer.MessageProcessor
false
.processMessage
在接口中 ChannelOutboundBuffer.MessageProcessor
java.lang.Exception