diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java index 73f7401b73..37ab679c4d 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java @@ -91,7 +91,7 @@ public class ChunkedFile implements ChunkedInput { return offset; } - public boolean available() throws Exception { + public boolean hasNextChunk() throws Exception { return offset < endOffset && file.getChannel().isOpen(); } @@ -99,7 +99,7 @@ public class ChunkedFile implements ChunkedInput { file.close(); } - public Object readChunk() throws Exception { + public Object nextChunk() throws Exception { long offset = this.offset; if (offset >= endOffset) { return null; diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedInput.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedInput.java index b7fad7edc3..6cdd4e2c3c 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedInput.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedInput.java @@ -30,7 +30,7 @@ package org.jboss.netty.handler.stream; * @version $Rev$, $Date$ */ public interface ChunkedInput { - boolean available() throws Exception; - Object readChunk() throws Exception; + boolean hasNextChunk() throws Exception; + Object nextChunk() throws Exception; void close() throws Exception; } diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedStream.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedStream.java index d6c4e0e62c..f98987d711 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedStream.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedStream.java @@ -66,7 +66,7 @@ public class ChunkedStream implements ChunkedInput { return offset; } - public boolean available() throws Exception { + public boolean hasNextChunk() throws Exception { int b = in.read(); if (b < 0) { return false; @@ -80,8 +80,8 @@ public class ChunkedStream implements ChunkedInput { in.close(); } - public Object readChunk() throws Exception { - if (!available()) { + public Object nextChunk() throws Exception { + if (!hasNextChunk()) { return null; } diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java index 1aff58abc3..c3067a5510 100644 --- a/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java +++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedWriteHandler.java @@ -101,8 +101,8 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns Object chunk; boolean last; try { - chunk = chunks.readChunk(); - last = !chunks.available(); + chunk = chunks.nextChunk(); + last = !chunks.hasNextChunk(); } catch (Throwable t) { currentEvent.getFuture().setFailure(t); fireExceptionCaught(ctx, t);