T
- The type of Streampublic abstract class AbstractStreamWriteFilter<T> extends IoFilterAdapter
IoSession.write(Object)
.IoFilter.NextFilter
Modifier and Type | Field and Description |
---|---|
protected static AttributeKey |
CURRENT_STREAM
The attribute name used when binding the streaming object to the session.
|
protected static AttributeKey |
CURRENT_WRITE_REQUEST |
static int |
DEFAULT_STREAM_BUFFER_SIZE
The default buffer size this filter uses for writing.
|
protected static 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() |
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, inputClosed, messageReceived, onPostAdd, onPostRemove, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toString
public static final int DEFAULT_STREAM_BUFFER_SIZE
protected static final AttributeKey CURRENT_STREAM
protected static final AttributeKey WRITE_REQUEST_QUEUE
protected static final AttributeKey CURRENT_WRITE_REQUEST
public void onPreAdd(IoFilterChain parent, String name, IoFilter.NextFilter nextFilter) throws Exception
parent
.
Please note that this method can be invoked more than once if
this filter is added to more than one parents. This method is not
invoked before IoFilter.init()
is invoked.onPreAdd
in interface IoFilter
onPreAdd
in class 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.Exception
- If an error occurred while processing the eventpublic void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception
IoSession.write(Object)
method invocation.filterWrite
in interface IoFilter
filterWrite
in class 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 processException
- If an error occurred while processing the eventpublic void messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws Exception
IoHandler.messageSent(IoSession,Object)
event.messageSent
in interface IoFilter
messageSent
in class 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 messageException
- If an error occurred while processing the eventpublic int getWriteBufferSize()
public void setWriteBufferSize(int writeBufferSize)
writeBufferSize
- The size of the write bufferIllegalArgumentException
- if the specified size is < 1.protected abstract IoBuffer getNextBuffer(T message) throws IOException
IOException
Copyright © 2004–2023 Apache MINA Project. All rights reserved.