T
- the type of message that will be written; see createMessage(ByteBuf)
public abstract class AbstractByteBufBackedChannelOutboundInvokingOutputStream<T> extends AbstractChannelOutboundInvokingOutputStream<T>
createMessage(ByteBuf)
Modifier and Type | Class and Description |
---|---|
static interface |
AbstractByteBufBackedChannelOutboundInvokingOutputStream.ByteBufCreator
|
channelOutboundInvoker, closeChannelOutboundInvoker
Modifier | Constructor and Description |
---|---|
protected |
AbstractByteBufBackedChannelOutboundInvokingOutputStream(ChannelOutboundInvoker channelOutboundInvoker,
boolean closeChannelOutboundInvoker)
Creates a new
AbstractByteBufBackedChannelOutboundInvokingOutputStream . |
protected |
AbstractByteBufBackedChannelOutboundInvokingOutputStream(ChannelOutboundInvoker channelOutboundInvoker,
int flushThreshold,
boolean closeChannelOutboundInvoker)
Creates a new
AbstractByteBufBackedChannelOutboundInvokingOutputStream . |
protected |
AbstractByteBufBackedChannelOutboundInvokingOutputStream(ChannelOutboundInvoker channelOutboundInvoker,
int flushThreshold,
boolean closeChannelOutboundInvoker,
AbstractByteBufBackedChannelOutboundInvokingOutputStream.ByteBufCreator byteBufCreator)
Creates a new
AbstractByteBufBackedChannelOutboundInvokingOutputStream . |
Modifier and Type | Method and Description |
---|---|
protected T |
createMessage(byte[] bytes,
int offset,
int length)
Returns the result of invoking the
createMessage(ByteBuf) method with a ByteBuf returned
by the AbstractByteBufBackedChannelOutboundInvokingOutputStream.ByteBufCreator supplied at construction time. |
protected abstract T |
createMessage(ByteBuf content)
Creates and returns a new message to be written.
|
close, createLastMessage, createMessage, flush, getFlushThreshold, newPromise, write, write, write
protected AbstractByteBufBackedChannelOutboundInvokingOutputStream(ChannelOutboundInvoker channelOutboundInvoker, boolean closeChannelOutboundInvoker)
AbstractByteBufBackedChannelOutboundInvokingOutputStream
.channelOutboundInvoker
- the ChannelOutboundInvoker
to which operations are adapted; must not be null
closeChannelOutboundInvoker
- whether ChannelOutboundInvoker.close(ChannelPromise)
will be called on
the supplied ChannelOutboundInvoker
when close()
is calledAbstractByteBufBackedChannelOutboundInvokingOutputStream(ChannelOutboundInvoker,
int, boolean, ByteBufCreator)
protected AbstractByteBufBackedChannelOutboundInvokingOutputStream(ChannelOutboundInvoker channelOutboundInvoker, int flushThreshold, boolean closeChannelOutboundInvoker)
AbstractByteBufBackedChannelOutboundInvokingOutputStream
.channelOutboundInvoker
- the ChannelOutboundInvoker
to which operations are adapted; must not be null
flushThreshold
- the minimum number of bytes that this
instance has to write
before an automatic flush will take place;
if less than 0
0
will be used instead; if Integer.MAX_VALUE
then no automatic flushing will occurcloseChannelOutboundInvoker
- whether ChannelOutboundInvoker.close(ChannelPromise)
will be called on
the supplied ChannelOutboundInvoker
when close()
is calledAbstractByteBufBackedChannelOutboundInvokingOutputStream(ChannelOutboundInvoker,
int, boolean, ByteBufCreator)
protected AbstractByteBufBackedChannelOutboundInvokingOutputStream(ChannelOutboundInvoker channelOutboundInvoker, int flushThreshold, boolean closeChannelOutboundInvoker, AbstractByteBufBackedChannelOutboundInvokingOutputStream.ByteBufCreator byteBufCreator)
AbstractByteBufBackedChannelOutboundInvokingOutputStream
.channelOutboundInvoker
- the ChannelOutboundInvoker
to which operations are adapted; must not be null
flushThreshold
- the minimum number of bytes that this
instance has to write
before an automatic flush will take place;
if less than 0
0
will be used instead; if Integer.MAX_VALUE
then no automatic flushing will occurcloseChannelOutboundInvoker
- whether ChannelOutboundInvoker.close(ChannelPromise)
will be called on
the supplied ChannelOutboundInvoker
when close()
is calledbyteBufCreator
- a AbstractByteBufBackedChannelOutboundInvokingOutputStream.ByteBufCreator
that will be used
to create
ByteBuf
instances; may be null
in which
case a default AbstractByteBufBackedChannelOutboundInvokingOutputStream.ByteBufCreator
adapting Unpooled.wrappedBuffer(byte[], int, int)
will be used insteadAbstractByteBufBackedChannelOutboundInvokingOutputStream.ByteBufCreator
,
Unpooled.wrappedBuffer(byte[], int, int)
protected final T createMessage(byte[] bytes, int offset, int length) throws IOException
createMessage(ByteBuf)
method with a ByteBuf
returned
by the AbstractByteBufBackedChannelOutboundInvokingOutputStream.ByteBufCreator
supplied at construction time.createMessage
in class AbstractChannelOutboundInvokingOutputStream<T>
bytes
- a byte
array originating from,
e.g., a AbstractChannelOutboundInvokingOutputStream.write(byte[], int, int)
method
invocation; will never be null
offset
- the (validated) offset within the supplied byte
array from which to start reading; will always be 0
or a positive int
less than length
length
- the (validated) length of the portion to read; will
always be 0
or a positive int
less than or equal
to the length
of the supplied byte
arraynull
message to writeIndexOutOfBoundsException
- if offset
is
negative, or length
is negative, or offset +
length
is greater than the length of bytes
IOException
- if the createMessage(ByteBuf)
method throws an IOException
createMessage(ByteBuf)
protected abstract T createMessage(ByteBuf content) throws IOException
This method is called by the createMessage(byte[],
int, int)
method.
content
- the ByteBuf
to construct the message from;
will never be null
; must be read in its entirety,
i.e. the return value of its ByteBuf.readableBytes()
method after this method has completed must be 0
IOException
- if an error occurscreateMessage(byte[], int, int)
Copyright © 2019–2020, microBean™. All rights reserved.