public abstract class AbstractStreamWriteFilter<T> extends IoFilterAdapter
IoFilter.NextFilter
限定符和类型 | 字段和说明 |
---|---|
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 |
构造器和说明 |
---|
AbstractStreamWriteFilter() |
限定符和类型 | 方法和说明 |
---|---|
void |
filterWrite(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters
IoSession.write(Object) method invocation. |
protected abstract java.lang.Class<T> |
getMessageClass() |
protected abstract IoBuffer |
getNextBuffer(T message) |
int |
getWriteBufferSize() |
void |
messageSent(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters
IoHandler.messageSent(IoSession,Object) event. |
void |
onPreAdd(IoFilterChain parent,
java.lang.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, inputClosed, messageReceived, onPostAdd, onPostRemove, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toString
public 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, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.Exception
IoFilterAdapter
IoFilter.init()
is invoked.onPreAdd
在接口中 IoFilter
onPreAdd
在类中 IoFilterAdapter
parent
- 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.java.lang.Exception
- If an error occurred while processing the eventpublic void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws java.lang.Exception
IoFilterAdapter
IoSession.write(Object)
method invocation.filterWrite
在接口中 IoFilter
filterWrite
在类中 IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has to process this invocationwriteRequest
- The WriteRequest
to processjava.lang.Exception
- If an error occurred while processing the eventprotected abstract java.lang.Class<T> getMessageClass()
public void messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws java.lang.Exception
IoFilterAdapter
IoHandler.messageSent(IoSession,Object)
event.messageSent
在接口中 IoFilter
messageSent
在类中 IoFilterAdapter
nextFilter
- the IoFilter.NextFilter
for this filter. You can reuse this
object until this filter is removed from the chain.session
- The IoSession
which has received this eventwriteRequest
- The WriteRequest
that contains the sent messagejava.lang.Exception
- If an error occurred while processing the eventpublic int getWriteBufferSize()
public void setWriteBufferSize(int writeBufferSize)
writeBufferSize
- The size of the write bufferjava.lang.IllegalArgumentException
- if the specified size is < 1.