public class IoFilterAdapter extends java.lang.Object implements IoFilter
IoFilter
. You can extend
this class and selectively override required event filter methods only. All
methods forwards events to the next filter by default.IoFilter.NextFilter
构造器和说明 |
---|
IoFilterAdapter() |
限定符和类型 | 方法和说明 |
---|---|
void |
destroy()
Invoked by
ReferenceCountingFilter when this filter
is not used by any IoFilterChain anymore, so you can destroy
shared resources. |
void |
exceptionCaught(IoFilter.NextFilter nextFilter,
IoSession session,
java.lang.Throwable cause)
Filters
IoHandler.exceptionCaught(IoSession,Throwable) event. |
void |
filterClose(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoSession.close(boolean) method invocation. |
void |
filterWrite(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters
IoSession.write(Object) method invocation. |
void |
init()
Invoked by
ReferenceCountingFilter when this filter
is added to a IoFilterChain at the first time, so you can
initialize shared resources. |
void |
inputClosed(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.inputClosed(IoSession) event. |
void |
messageReceived(IoFilter.NextFilter nextFilter,
IoSession session,
java.lang.Object message)
Filters
IoHandler.messageReceived(IoSession,Object) event. |
void |
messageSent(IoFilter.NextFilter nextFilter,
IoSession session,
WriteRequest writeRequest)
Filters
IoHandler.messageSent(IoSession,Object) event. |
void |
onPostAdd(IoFilterChain parent,
java.lang.String name,
IoFilter.NextFilter nextFilter)
Invoked after this filter is added to the specified parent.
|
void |
onPostRemove(IoFilterChain parent,
java.lang.String name,
IoFilter.NextFilter nextFilter)
Invoked after this filter is removed from the specified parent.
|
void |
onPreAdd(IoFilterChain parent,
java.lang.String name,
IoFilter.NextFilter nextFilter)
Invoked before this filter is added to the specified parent.
|
void |
onPreRemove(IoFilterChain parent,
java.lang.String name,
IoFilter.NextFilter nextFilter)
Invoked before this filter is removed from the specified parent.
|
void |
sessionClosed(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionClosed(IoSession) event. |
void |
sessionCreated(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionCreated(IoSession) event. |
void |
sessionIdle(IoFilter.NextFilter nextFilter,
IoSession session,
IdleStatus status)
Filters
IoHandler.sessionIdle(IoSession,IdleStatus) event. |
void |
sessionOpened(IoFilter.NextFilter nextFilter,
IoSession session)
Filters
IoHandler.sessionOpened(IoSession) event. |
java.lang.String |
toString() |
public void init() throws java.lang.Exception
ReferenceCountingFilter
when this filter
is added to a IoFilterChain
at the first time, so you can
initialize shared resources. Please note that this method is never
called if you don't wrap a filter with ReferenceCountingFilter
.public void destroy() throws java.lang.Exception
ReferenceCountingFilter
when this filter
is not used by any IoFilterChain
anymore, so you can destroy
shared resources. Please note that this method is never called if
you don't wrap a filter with ReferenceCountingFilter
.public void onPreAdd(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.Exception
IoFilter.init()
is invoked.onPreAdd
在接口中 IoFilter
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 onPostAdd(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.Exception
IoFilter.init()
is invoked.onPostAdd
在接口中 IoFilter
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 onPreRemove(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.Exception
IoFilter.destroy()
is invoked.onPreRemove
在接口中 IoFilter
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 onPostRemove(IoFilterChain parent, java.lang.String name, IoFilter.NextFilter nextFilter) throws java.lang.Exception
IoFilter.destroy()
is invoked.onPostRemove
在接口中 IoFilter
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 sessionCreated(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
IoHandler.sessionCreated(IoSession)
event.sessionCreated
在接口中 IoFilter
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 eventjava.lang.Exception
- If an error occurred while processing the eventpublic void sessionOpened(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
IoHandler.sessionOpened(IoSession)
event.sessionOpened
在接口中 IoFilter
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 eventjava.lang.Exception
- If an error occurred while processing the eventpublic void sessionClosed(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
IoHandler.sessionClosed(IoSession)
event.sessionClosed
在接口中 IoFilter
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 eventjava.lang.Exception
- If an error occurred while processing the eventpublic void sessionIdle(IoFilter.NextFilter nextFilter, IoSession session, IdleStatus status) throws java.lang.Exception
IoHandler.sessionIdle(IoSession,IdleStatus)
event.sessionIdle
在接口中 IoFilter
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 eventstatus
- The IdleStatus
typejava.lang.Exception
- If an error occurred while processing the eventpublic void exceptionCaught(IoFilter.NextFilter nextFilter, IoSession session, java.lang.Throwable cause) throws java.lang.Exception
IoHandler.exceptionCaught(IoSession,Throwable)
event.exceptionCaught
在接口中 IoFilter
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 eventcause
- The exception that cause this event to be receivedjava.lang.Exception
- If an error occurred while processing the eventpublic void messageReceived(IoFilter.NextFilter nextFilter, IoSession session, java.lang.Object message) throws java.lang.Exception
IoHandler.messageReceived(IoSession,Object)
event.messageReceived
在接口中 IoFilter
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 eventmessage
- The received messagejava.lang.Exception
- If an error occurred while processing the eventpublic void messageSent(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws java.lang.Exception
IoHandler.messageSent(IoSession,Object)
event.messageSent
在接口中 IoFilter
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 void filterWrite(IoFilter.NextFilter nextFilter, IoSession session, WriteRequest writeRequest) throws java.lang.Exception
IoSession.write(Object)
method invocation.filterWrite
在接口中 IoFilter
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 eventpublic void filterClose(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
IoSession.close(boolean)
method invocation.filterClose
在接口中 IoFilter
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 method
invocationjava.lang.Exception
- If an error occurred while processing the eventpublic void inputClosed(IoFilter.NextFilter nextFilter, IoSession session) throws java.lang.Exception
IoHandler.inputClosed(IoSession)
event.inputClosed
在接口中 IoFilter
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 eventjava.lang.Exception
- If an error occurred while processing the eventpublic java.lang.String toString()
toString
在类中 java.lang.Object