Skip to content

Commit e2655f3

Browse files
committed
NETTY-389 java.lang.ClassCastException: org.jboss.netty.channel.FileRegion cannot be cast to org.jboss.netty.buffer.ChannelBuffer
* Updated JavaDoc to let users know that not all transports support FileRegion * Added FIXME for future improvement
1 parent 2acd74d commit e2655f3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/main/java/org/jboss/netty/channel/FileRegion.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,21 @@
4848
* transfer, sending a file with {@link FileRegion} might fail or yield worse
4949
* performance. For example, sending a large file doesn't work well in Windows.
5050
*
51+
* <h3>Not all transports support it</h3>
52+
*
53+
* Currently, the NIO transport is the only transport that supports {@link FileRegion}.
54+
* Attempting to write a {@link FileRegion} to non-NIO {@link Channel} will trigger
55+
* a {@link ClassCastException} or a similar exception.
56+
*
5157
* @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
5258
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
5359
* @version $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
5460
*/
5561
public interface FileRegion extends ExternalResourceReleasable {
5662

63+
// FIXME Make sure all transports support writing a FileRegion
64+
// Even if zero copy cannot be achieved, all transports should emulate it.
65+
5766
/**
5867
* Returns the offset in the file where the transfer began.
5968
*/

0 commit comments

Comments
 (0)