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.
| Modifier | Constructor and Description |
|---|---|
protected |
StreamIoHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
exceptionCaught(IoSession session,
Throwable cause)
Forwards caught exceptions to input stream.
|
int |
getReadTimeout()
Returns read timeout in seconds.
|
int |
getWriteTimeout()
Returns write timeout in seconds.
|
void |
messageReceived(IoSession session,
Object buf)
Forwards read data to input stream.
|
protected abstract void |
processStreamIo(IoSession session,
InputStream in,
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.
|
messageSent, sessionCreatedprotected abstract void processStreamIo(IoSession session, InputStream in, OutputStream out)
public int getReadTimeout()
public void setReadTimeout(int readTimeout)
public int getWriteTimeout()
public void setWriteTimeout(int writeTimeout)
public void sessionOpened(IoSession session)
sessionOpened in interface IoHandlersessionOpened in class IoHandlerAdapterpublic void sessionClosed(IoSession session) throws Exception
sessionClosed in interface IoHandlersessionClosed in class IoHandlerAdapterExceptionpublic void messageReceived(IoSession session, Object buf)
messageReceived in interface IoHandlermessageReceived in class IoHandlerAdapterpublic void exceptionCaught(IoSession session, Throwable cause)
exceptionCaught in interface IoHandlerexceptionCaught in class IoHandlerAdapterpublic void sessionIdle(IoSession session, IdleStatus status)
sessionIdle in interface IoHandlersessionIdle in class IoHandlerAdapter