Package org.apache.mina.filter.stream
Class FileRegionWriteFilter
- java.lang.Object
-
- org.apache.mina.core.filterchain.IoFilterAdapter
-
- org.apache.mina.filter.stream.AbstractStreamWriteFilter<FileRegion>
-
- org.apache.mina.filter.stream.FileRegionWriteFilter
-
- All Implemented Interfaces:
IoFilter
public class FileRegionWriteFilter extends AbstractStreamWriteFilter<FileRegion>
Filter implementation that converts aFileRegiontoIoBufferobjects and writes those buffers to the next filter. When end of theFileRegionhas been reached this filter will callIoFilter.NextFilter.messageSent(org.apache.mina.core.session.IoSession, org.apache.mina.core.write.WriteRequest)using the originalFileRegionwritten to the session and notifiesWriteFutureon the originalWriteRequest.Normall
FileRegionobjects should be handled by theIoProcessorbut this is not always possible if a filter is being used that needs to modify the contents of the file before sending over the network (i.e. theSslFilteror a data compression filter.)This filter will ignore written messages which aren't
FileRegioninstances. Such messages will be passed to the next filter directly.NOTE: this filter does not close the file channel in
FileRegion.getFileChannel()after the data from the file has been written. TheFileChannelshould be closed in eitherIoHandler.messageSent(IoSession,Object)or in anIoFutureListenerassociated with theWriteFuture.- 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 FileRegionWriteFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Class<FileRegion>getMessageClass()protected IoBuffergetNextBuffer(FileRegion fileRegion)-
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, event, exceptionCaught, filterClose, init, inputClosed, messageReceived, onPostAdd, onPostRemove, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toString
-
-
-
-
Method Detail
-
getMessageClass
protected Class<FileRegion> getMessageClass()
- Specified by:
getMessageClassin classAbstractStreamWriteFilter<FileRegion>
-
getNextBuffer
protected IoBuffer getNextBuffer(FileRegion fileRegion) throws IOException
- Specified by:
getNextBufferin classAbstractStreamWriteFilter<FileRegion>- Throws:
IOException
-
-