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 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(IoSession,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.
- 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 |
FileRegionWriteFilter
public FileRegionWriteFilter()
getMessageClass
protected Class<FileRegion> getMessageClass()
- Specified by:
getMessageClass in class AbstractStreamWriteFilter<FileRegion>
getNextBuffer
protected IoBuffer getNextBuffer(FileRegion fileRegion)
throws IOException
- Specified by:
getNextBuffer in class AbstractStreamWriteFilter<FileRegion>
- Throws:
IOException
Copyright © 2004-2009 Apache MINA Project. All Rights Reserved.