Skip to content

Commit

Permalink
NETTY-389 java.lang.ClassCastException: org.jboss.netty.channel.FileR…
Browse files Browse the repository at this point in the history
…egion 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
  • Loading branch information
trustin committed Jul 31, 2011
1 parent 2acd74d commit e2655f3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/org/jboss/netty/channel/FileRegion.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,21 @@
* transfer, sending a file with {@link FileRegion} might fail or yield worse
* performance. For example, sending a large file doesn't work well in Windows.
*
* <h3>Not all transports support it</h3>
*
* Currently, the NIO transport is the only transport that supports {@link FileRegion}.
* Attempting to write a {@link FileRegion} to non-NIO {@link Channel} will trigger
* a {@link ClassCastException} or a similar exception.
*
* @author <a href="http://www.jboss.org/netty/">The Netty Project</a>
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
* @version $Rev: 2080 $, $Date: 2010-01-26 18:04:19 +0900 (Tue, 26 Jan 2010) $
*/
public interface FileRegion extends ExternalResourceReleasable {

// FIXME Make sure all transports support writing a FileRegion
// Even if zero copy cannot be achieved, all transports should emulate it.

/**
* Returns the offset in the file where the transfer began.
*/
Expand Down

0 comments on commit e2655f3

Please sign in to comment.