public abstract class AbstractStreamWriteFilter<T> extends IoFilterAdapter
IoFilter.NextFilter| Modifier and Type | Field and Description |
|---|---|
protected AttributeKey |
CURRENT_STREAM
The attribute name used when binding the streaming object to the session.
|
protected AttributeKey |
CURRENT_WRITE_REQUEST |
static int |
DEFAULT_STREAM_BUFFER_SIZE
The default buffer size this filter uses for writing.
|
protected AttributeKey |
WRITE_REQUEST_QUEUE |
| Constructor and Description |
|---|
AbstractStreamWriteFilter() |
| Modifier and Type | Method and Description |
|---|---|
void |
filterWrite(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters
IoSession.write(Object) method invocation. |
protected abstract Class<T> |
getMessageClass() |
protected abstract IoBuffer |
getNextBuffer(T message) |
int |
getWriteBufferSize()
Returns the size of the write buffer in bytes.
|
void |
messageSent(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters
IoHandler.messageSent(IoSession,Object)
event. |
void |
onPreAdd(IoFilterChain parent,
String name,
IoFilter.NextFilter nextFilter)
Invoked before this filter is added to the specified parent.
|
void |
setWriteBufferSize(int writeBufferSize)
Sets the size of the write buffer in bytes.
|
destroy, exceptionCaught, filterClose, init, messageReceived, onPostAdd, onPostRemove, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toStringpublic static final int DEFAULT_STREAM_BUFFER_SIZE
protected final AttributeKey CURRENT_STREAM
protected final AttributeKey WRITE_REQUEST_QUEUE
protected final AttributeKey CURRENT_WRITE_REQUEST
public void onPreAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception
IoFilterAdapterIoFilter.init() is invoked.onPreAdd in interface IoFilteronPreAdd in class IoFilterAdapterparent - the parent who called this methodname - the name assigned to this filternextFilter - the IoFilter.NextFilter for this filter. You can reuse
this object until this filter is removed from the chain.Exceptionpublic void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception
IoFilterAdapterIoSession.write(Object) method invocation.filterWrite in interface IoFilterfilterWrite in class IoFilterAdapterExceptionpublic void messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception
IoFilterAdapterIoHandler.messageSent(IoSession,Object)
event.messageSent in interface IoFiltermessageSent in class IoFilterAdapterExceptionpublic int getWriteBufferSize()
public void setWriteBufferSize(int writeBufferSize)
IllegalArgumentException - if the specified size is < 1.protected abstract IoBuffer getNextBuffer(T message) throws IOException
IOException