public abstract class StreamIoHandler extends IoHandlerAdapter
IoHandler that adapts asynchronous MINA events to stream I/O.
Please extend this class and implement
processStreamIo(IoSession, InputStream, OutputStream) to
execute your stream I/O logic; please note that you must forward
the process request to other thread or thread pool.
| 限定符 | 构造器和说明 |
|---|---|
protected |
StreamIoHandler() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
exceptionCaught(IoSession session,
java.lang.Throwable cause)
Forwards caught exceptions to input stream.
|
int |
getReadTimeout() |
int |
getWriteTimeout() |
void |
messageReceived(IoSession session,
java.lang.Object buf)
Forwards read data to input stream.
|
protected abstract void |
processStreamIo(IoSession session,
java.io.InputStream in,
java.io.OutputStream out)
Implement this method to execute your stream I/O logic;
please note that you must forward the process request to other
thread or thread pool.
|
void |
sessionClosed(IoSession session)
Closes streams
|
void |
sessionIdle(IoSession session,
IdleStatus status)
Handles read timeout.
|
void |
sessionOpened(IoSession session)
Initializes streams and timeout settings.
|
void |
setReadTimeout(int readTimeout)
Sets read timeout in seconds.
|
void |
setWriteTimeout(int writeTimeout)
Sets write timeout in seconds.
|
inputClosed, messageSent, sessionCreatedprotected abstract void processStreamIo(IoSession session, java.io.InputStream in, java.io.OutputStream out)
session - The current sessionin - The input streamout - The output streampublic int getReadTimeout()
public void setReadTimeout(int readTimeout)
readTimeout - The Read timeoutpublic int getWriteTimeout()
public void setWriteTimeout(int writeTimeout)
writeTimeout - The Write timeoutpublic void sessionOpened(IoSession session)
sessionOpened 在接口中 IoHandlersessionOpened 在类中 IoHandlerAdaptersession - The session being openedpublic void sessionClosed(IoSession session) throws java.lang.Exception
sessionClosed 在接口中 IoHandlersessionClosed 在类中 IoHandlerAdaptersession - The session being closedjava.lang.Exception - If we get an exception while processing the close eventpublic void messageReceived(IoSession session, java.lang.Object buf)
messageReceived 在接口中 IoHandlermessageReceived 在类中 IoHandlerAdaptersession - The session that is receiving a messagebuf - The received messagepublic void exceptionCaught(IoSession session, java.lang.Throwable cause)
exceptionCaught 在接口中 IoHandlerexceptionCaught 在类中 IoHandlerAdaptersession - The session for which we have got an exceptioncause - The exception that has been caughtpublic void sessionIdle(IoSession session, IdleStatus status)
sessionIdle 在接口中 IoHandlersessionIdle 在类中 IoHandlerAdaptersession - The idling sessionstatus - The session's status