This commit is contained in:
Trustin Lee 2009-06-19 10:53:29 +00:00
parent 592e62573f
commit f19cfb45e9
3 changed files with 16 additions and 15 deletions

View File

@ -29,7 +29,7 @@ import java.io.IOException;
import java.io.RandomAccessFile;
/**
* A {@link ChunkedInput} that fetches the chunks from a file.
* A {@link ChunkedInput} that fetches data from a file chunk by chunk.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
@ -44,14 +44,14 @@ public class ChunkedFile implements ChunkedInput {
private volatile long offset;
/**
* Creates a new instance that fetches the chunks from the specified file.
* Creates a new instance that fetches data from the specified file.
*/
public ChunkedFile(File file) throws IOException {
this(file, ChunkedStream.DEFAULT_CHUNK_SIZE);
}
/**
* Creates a new instance that fetches the chunks from the specified file.
* Creates a new instance that fetches data from the specified file.
*
* @param chunkSize the number of bytes to fetch on each
* {@link #nextChunk()} call
@ -61,7 +61,7 @@ public class ChunkedFile implements ChunkedInput {
}
/**
* Creates a new instance that fetches the chunks from the specified file.
* Creates a new instance that fetches data from the specified file.
*
* @param chunkSize the number of bytes to fetch on each
* {@link #nextChunk()} call
@ -71,7 +71,7 @@ public class ChunkedFile implements ChunkedInput {
}
/**
* Creates a new instance that fetches the chunks from the specified file.
* Creates a new instance that fetches data from the specified file.
*
* @param offset the offset of the file where the transfer begins
* @param length the number of bytes to transfer
@ -119,7 +119,7 @@ public class ChunkedFile implements ChunkedInput {
}
/**
* Returns the offset in the file where the transfer is occuring currently.
* Returns the offset in the file where the transfer is happening currently.
*/
public long getCurrentOffset() {
return offset;

View File

@ -34,19 +34,19 @@ import org.jboss.netty.buffer.ChannelBuffer;
public interface ChunkedInput {
/**
* Returns {@code true} if and only if there is more chunk left in the
* Returns {@code true} if and only if there is any data left in the
* stream.
*/
boolean hasNextChunk() throws Exception;
/**
* Fetches a chunk from the stream. The returned chunk is usually
* a {@link ChannelBuffer}, but you could extend an existing
* {@link ChunkedInput} implementation to convert the {@link ChannelBuffer}
* into a different type that your handler or encoder understands.
* Fetches a chunked data from the stream. The returned chunk is usually
* a {@link ChannelBuffer}, but you could extend an existing implementation
* to convert the {@link ChannelBuffer} into a different type that your
* handler or encoder understands.
*
* @return the fetched chunk, which is usually {@link ChannelBuffer}.
* {@code null} if there is no more chunk left in the stream.
* {@code null} if there is no data left in the stream.
*/
Object nextChunk() throws Exception;

View File

@ -28,7 +28,8 @@ import java.io.InputStream;
import java.io.PushbackInputStream;
/**
* A {@link ChunkedInput} that fetches the chunks from an {@link InputStream}.
* A {@link ChunkedInput} that fetches data from an {@link InputStream} chunk by
* chunk.
*
* @author The Netty Project (netty-dev@lists.jboss.org)
* @author Trustin Lee (tlee@redhat.com)
@ -43,14 +44,14 @@ public class ChunkedStream implements ChunkedInput {
private volatile long offset;
/**
* Creates a new instance that fetches the chunks from the specified stream.
* Creates a new instance that fetches data from the specified stream.
*/
public ChunkedStream(InputStream in) {
this(in, DEFAULT_CHUNK_SIZE);
}
/**
* Creates a new instance that fetches the chunks from the specified stream.
* Creates a new instance that fetches data from the specified stream.
*
* @param chunkSize the number of bytes to fetch on each
* {@link #nextChunk()} call