Renamed ChunkedInput.available to hasNextChunk
Renamed ChunkedInput.readChunk to nextChunk
This commit is contained in:
parent
cd23da084a
commit
cc0e6020d1
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user