Package 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 writeInputStream
objects directly usingIoSession.write(Object)
. When anInputStream
is written to a session this filter will read the bytes from the stream intoIoBuffer
objects and write those buffers to the next filter. When end of stream has been reached this filter will callIoFilter.NextFilter.messageSent(org.apache.mina.core.session.IoSession, org.apache.mina.core.write.WriteRequest)
using the originalInputStream
written to the session and notifiesWriteFuture
on the originalWriteRequest
.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 itsIoHandler.messageSent(IoSession,Object)
callback.- Author:
- Apache MINA Project
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.mina.core.filterchain.IoFilter
IoFilter.NextFilter
-
-
Field Summary
-
Fields inherited from class org.apache.mina.filter.stream.AbstractStreamWriteFilter
CURRENT_STREAM, CURRENT_WRITE_REQUEST, DEFAULT_STREAM_BUFFER_SIZE, WRITE_REQUEST_QUEUE
-
-
Constructor Summary
Constructors Constructor Description StreamWriteFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Class<InputStream>
getMessageClass()
protected IoBuffer
getNextBuffer(InputStream is)
-
Methods inherited from class org.apache.mina.filter.stream.AbstractStreamWriteFilter
filterWrite, getWriteBufferSize, messageSent, onPreAdd, setWriteBufferSize
-
Methods inherited from class org.apache.mina.core.filterchain.IoFilterAdapter
destroy, exceptionCaught, filterClose, init, inputClosed, messageReceived, onPostAdd, onPostRemove, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toString
-
-
-
-
Method Detail
-
getNextBuffer
protected IoBuffer getNextBuffer(InputStream is) throws IOException
- Specified by:
getNextBuffer
in classAbstractStreamWriteFilter<InputStream>
- Throws:
IOException
-
getMessageClass
protected Class<InputStream> getMessageClass()
- Specified by:
getMessageClass
in classAbstractStreamWriteFilter<InputStream>
-
-