Skip to content

Commit

Permalink
Doc
Browse files Browse the repository at this point in the history
  • Loading branch information
pepite committed Feb 26, 2010
1 parent c3047b8 commit e77ef32
Showing 1 changed file with 15 additions and 23 deletions.
38 changes: 15 additions & 23 deletions src/play/modules/netty/FileChannelBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
import java.nio.channels.ScatteringByteChannel;


/**
* Useless channel buffer only used to wrap the input stream....
*/
public class FileChannelBuffer extends AbstractChannelBuffer implements WrappedChannelBuffer {

private final File file;
Expand Down Expand Up @@ -124,13 +127,11 @@ public void setLong(int index, long value) {

public int setBytes(int index, InputStream in, int length)
throws IOException {
Logger.info("RuntimeException");
throw new RuntimeException();
}

public int setBytes(int index, ScatteringByteChannel in, int length)
throws IOException {
Logger.info("RuntimeException");
throw new RuntimeException();

}
Expand All @@ -143,7 +144,6 @@ public int readerIndex() {

public int getBytes(int index, GatheringByteChannel out, int length)
throws IOException {
Logger.info("getBytes");
byte[] b = new byte[length];
is.read(b, index, length);
ByteBuffer bb = ByteBuffer.wrap(b);
Expand All @@ -152,15 +152,13 @@ public int getBytes(int index, GatheringByteChannel out, int length)

public void getBytes(int index, OutputStream out, int length)
throws IOException {
Logger.info("getBytes");
byte[] b = new byte[length];
is.read(b, index, length);
out.write(b, index, length);
}

public void getBytes(int index, byte[] dst, int dstIndex, int length) {
try {
Logger.info("getBytes");
byte[] b = new byte[length];
is.read(b, index, length);
System.arraycopy(b, 0, dst, dstIndex, length);
Expand All @@ -171,7 +169,6 @@ public void getBytes(int index, byte[] dst, int dstIndex, int length) {

public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) {
try {
Logger.info("getBytes");
byte[] b = new byte[length];
is.read(b, index, length);
dst.writeBytes(b, dstIndex, length);
Expand All @@ -182,7 +179,6 @@ public void getBytes(int index, ChannelBuffer dst, int dstIndex, int length) {

public void getBytes(int index, ByteBuffer dst) {
try {
Logger.info("getBytes");
byte[] b = new byte[is.available() - index];
is.read(b, index, is.available() - index);
dst.put(b);
Expand All @@ -192,28 +188,26 @@ public void getBytes(int index, ByteBuffer dst) {
}

public ChannelBuffer duplicate() {
Logger.info("duplicate");
throw new RuntimeException();
}

public ChannelBuffer copy(int index, int length) {
Logger.info("copy");
throw new RuntimeException();
}

public ChannelBuffer slice(int index, int length) {
Logger.info("slice");
throw new RuntimeException();
}

public byte getByte(int index) {
try {
byte[] b = new byte[1];
is.read(b, index, 1);
return b[0];
} catch (IOException e) {
throw new RuntimeException(e);
}
// try {
// byte[] b = new byte[1];
// is.read(b, index, 1);
// return b[0];
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
throw new RuntimeException();
}

public short getShort(int index) {
Expand All @@ -236,8 +230,6 @@ public long getLong(int index) {
}

public ByteBuffer toByteBuffer(int index, int length) {
//return buffer.getChannel().retoByteBuffer(index, length).asReadOnlyBuffer();
Logger.info("RuntimeException");
throw new RuntimeException();
}

Expand All @@ -248,7 +240,6 @@ public ByteBuffer[] toByteBuffers(int index, int length) {
// bufs[i] = bufs[i].asReadOnlyBuffer();
// }
// return bufs;
Logger.info("RuntimeException");
throw new RuntimeException();
}

Expand All @@ -262,9 +253,10 @@ public int capacity() {
}

public ChannelBuffer readBytes(int length) {
ChannelBuffer buf = ChannelBuffers.buffer(length);
getBytes(0, buf);
return buf;
// ChannelBuffer buf = ChannelBuffers.buffer(length);
// getBytes(0, buf);
// return buf;
throw new RuntimeException();
}

public ChannelBuffer readBytes(ChannelBufferIndexFinder endIndexFinder) {
Expand Down

0 comments on commit e77ef32

Please sign in to comment.