org.apache.mina.filter.stream
Class StreamWriteFilter
java.lang.Object
org.apache.mina.core.filterchain.IoFilterAdapter
org.apache.mina.filter.stream.AbstractStreamWriteFilter<InputStream>
org.apache.mina.filter.stream.StreamWriteFilter
- All Implemented Interfaces:
- IoFilter
public class StreamWriteFilter
- extends AbstractStreamWriteFilter<InputStream>
Filter implementation which makes it possible to write InputStream
objects directly using IoSession#write(Object)
. When an
InputStream
is written to a session this filter will read the bytes
from the stream into IoBuffer
objects and write those buffers
to the next filter. When end of stream has been reached this filter will
call IoFilter.NextFilter#messageSent(IoSession,WriteRequest)
using the original
InputStream
written to the session and notifies
WriteFuture
on the
original WriteRequest
.
This filter will ignore written messages which aren't InputStream
instances. Such messages will be passed to the next filter directly.
NOTE: this filter does not close the stream after all data from stream
has been written. The IoHandler
should take
care of that in its
IoHandler.messageSent(IoSession,Object)
callback.
- Author:
- Apache MINA Project
Methods inherited from class org.apache.mina.core.filterchain.IoFilterAdapter |
destroy, exceptionCaught, filterClose, init, messageReceived, onPostAdd, onPostRemove, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toString |
StreamWriteFilter
public StreamWriteFilter()
getNextBuffer
protected IoBuffer getNextBuffer(InputStream is)
throws IOException
- Specified by:
getNextBuffer
in class AbstractStreamWriteFilter<InputStream>
- Throws:
IOException
getMessageClass
protected Class<InputStream> getMessageClass()
- Specified by:
getMessageClass
in class AbstractStreamWriteFilter<InputStream>
Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.