diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java
new file mode 100644
index 0000000000..0d417d80ca
--- /dev/null
+++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedFile.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2010 Red Hat, Inc.
+ *
+ * Red Hat licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jboss.netty.handler.stream;
+
+import java.nio.channels.FileChannel;
+
+
+/**
+ * A {@link ChunkedInput} that fetches data from a file chunk by chunk.
+ *
+ * @author The Netty Project
+ * @author Trustin Lee
+ * @version $Rev: 2180 $, $Date: 2010-02-19 13:11:59 +0900 (Fri, 19 Feb 2010) $
+ */
+public interface ChunkedFile extends ChunkedInput {
+
+ /**
+ * Returns the {@link FileChannel} that this input fetches chunks from.
+ */
+ FileChannel getSource();
+
+ /**
+ * Returns the offset in the file where the transfer began.
+ */
+ long getStartOffset();
+
+ /**
+ * Returns the offset in the file where the transfer will end.
+ */
+ long getEndOffset();
+
+ /**
+ * Returns the offset in the file where the transfer is happening currently.
+ */
+ long getCurrentOffset();
+}
diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedNioFile.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedNioFile.java
index 4235485f46..c0e886d4dc 100644
--- a/src/main/java/org/jboss/netty/handler/stream/ChunkedNioFile.java
+++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedNioFile.java
@@ -32,7 +32,7 @@ import java.nio.channels.FileChannel;
* @author Frederic Bregier
* @version $Rev$, $Date$
*/
-public class ChunkedNioFile implements ChunkedInput {
+public class ChunkedNioFile implements ChunkedFile {
private final FileChannel in;
private long startOffset;
@@ -110,23 +110,18 @@ public class ChunkedNioFile implements ChunkedInput {
endOffset = offset + length;
}
- /**
- * Returns the offset in the file where the transfer began.
- */
+ public FileChannel getSource() {
+ return in;
+ }
+
public long getStartOffset() {
return startOffset;
}
- /**
- * Returns the offset in the file where the transfer will end.
- */
public long getEndOffset() {
return endOffset;
}
- /**
- * Returns the offset in the file where the transfer is happening currently.
- */
public long getCurrentOffset() {
return offset;
}
diff --git a/src/main/java/org/jboss/netty/handler/stream/ChunkedOioFile.java b/src/main/java/org/jboss/netty/handler/stream/ChunkedOioFile.java
index 804a02c439..244a4154ff 100644
--- a/src/main/java/org/jboss/netty/handler/stream/ChunkedOioFile.java
+++ b/src/main/java/org/jboss/netty/handler/stream/ChunkedOioFile.java
@@ -20,6 +20,7 @@ import static org.jboss.netty.buffer.ChannelBuffers.*;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
/**
* A {@link ChunkedInput} that fetches data from a file chunk by chunk.
@@ -28,7 +29,7 @@ import java.io.RandomAccessFile;
* @author Trustin Lee
* @version $Rev$, $Date$
*/
-public class ChunkedOioFile implements ChunkedInput {
+public class ChunkedOioFile implements ChunkedFile {
private final RandomAccessFile file;
private final long startOffset;
@@ -104,23 +105,18 @@ public class ChunkedOioFile implements ChunkedInput {
file.seek(offset);
}
- /**
- * Returns the offset in the file where the transfer began.
- */
+ public FileChannel getSource() {
+ return file.getChannel();
+ }
+
public long getStartOffset() {
return startOffset;
}
- /**
- * Returns the offset in the file where the transfer will end.
- */
public long getEndOffset() {
return endOffset;
}
- /**
- * Returns the offset in the file where the transfer is happening currently.
- */
public long getCurrentOffset() {
return offset;
}