Renamed ChunkedInput.available to hasNextChunk

Renamed ChunkedInput.readChunk to nextChunk
This commit is contained in:
Trustin Lee 2009-06-19 09:04:36 +00:00
parent cd23da084a
commit cc0e6020d1
4 changed files with 9 additions and 9 deletions

View File

@ -91,7 +91,7 @@ public class ChunkedFile implements ChunkedInput {
return offset; return offset;
} }
public boolean available() throws Exception { public boolean hasNextChunk() throws Exception {
return offset < endOffset && file.getChannel().isOpen(); return offset < endOffset && file.getChannel().isOpen();
} }
@ -99,7 +99,7 @@ public class ChunkedFile implements ChunkedInput {
file.close(); file.close();
} }
public Object readChunk() throws Exception { public Object nextChunk() throws Exception {
long offset = this.offset; long offset = this.offset;
if (offset >= endOffset) { if (offset >= endOffset) {
return null; return null;

View File

@ -30,7 +30,7 @@ package org.jboss.netty.handler.stream;
* @version $Rev$, $Date$ * @version $Rev$, $Date$
*/ */
public interface ChunkedInput { public interface ChunkedInput {
boolean available() throws Exception; boolean hasNextChunk() throws Exception;
Object readChunk() throws Exception; Object nextChunk() throws Exception;
void close() throws Exception; void close() throws Exception;
} }

View File

@ -66,7 +66,7 @@ public class ChunkedStream implements ChunkedInput {
return offset; return offset;
} }
public boolean available() throws Exception { public boolean hasNextChunk() throws Exception {
int b = in.read(); int b = in.read();
if (b < 0) { if (b < 0) {
return false; return false;
@ -80,8 +80,8 @@ public class ChunkedStream implements ChunkedInput {
in.close(); in.close();
} }
public Object readChunk() throws Exception { public Object nextChunk() throws Exception {
if (!available()) { if (!hasNextChunk()) {
return null; return null;
} }

View File

@ -101,8 +101,8 @@ public class ChunkedWriteHandler implements ChannelUpstreamHandler, ChannelDowns
Object chunk; Object chunk;
boolean last; boolean last;
try { try {
chunk = chunks.readChunk(); chunk = chunks.nextChunk();
last = !chunks.available(); last = !chunks.hasNextChunk();
} catch (Throwable t) { } catch (Throwable t) {
currentEvent.getFuture().setFailure(t); currentEvent.getFuture().setFailure(t);
fireExceptionCaught(ctx, t); fireExceptionCaught(ctx, t);