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
Filter implementation that converts a
FileRegion to IoBuffer
objects and writes those buffers to the next filter. When end of the
FileRegion has been reached this filter will call
IoFilter.NextFilter.messageSent(org.apache.mina.core.session.IoSession, org.apache.mina.core.write.WriteRequest) using the
original FileRegion written to the session and notifies
WriteFuture on the original
WriteRequest.
Normall FileRegion objects should be handled by the
IoProcessor but 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. the
SslFilter or a data compression filter.)
This filter will ignore written messages which aren't FileRegion
instances. 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. The FileChannel should be closed in either
IoHandler.messageSent(IoSession,Object)
or in an IoFutureListener associated with the
WriteFuture.
-
Nested Class Summary
Nested classes/interfaces inherited from interface IoFilter
IoFilter.NextFilter -
Field Summary
Fields inherited from class AbstractStreamWriteFilter
CURRENT_STREAM, CURRENT_WRITE_REQUEST, DEFAULT_STREAM_BUFFER_SIZE, WRITE_REQUEST_QUEUE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected Class<FileRegion> protected IoBuffergetNextBuffer(FileRegion fileRegion) Methods inherited from class AbstractStreamWriteFilter
filterWrite, getWriteBufferSize, messageSent, onPreAdd, setWriteBufferSizeMethods inherited from class IoFilterAdapter
destroy, event, exceptionCaught, filterClose, init, inputClosed, messageReceived, onPostAdd, onPostRemove, onPreRemove, sessionClosed, sessionCreated, sessionIdle, sessionOpened, toString
-
Constructor Details
-
FileRegionWriteFilter
public FileRegionWriteFilter()
-
-
Method Details
-
getMessageClass
- Specified by:
getMessageClassin classAbstractStreamWriteFilter<FileRegion>
-
getNextBuffer
- Specified by:
getNextBufferin classAbstractStreamWriteFilter<FileRegion>- Throws:
IOException
-