package pw.koj.jetstreem.core;

import java.nio.ByteBuffer;
import java.nio.channels.SelectableChannel;

public class ChannelReadBuffer {
    private static final int BUF_SIZE = 4096;
    private SelectableChannel ch;
    private ByteBuffer buf;

    public ChannelReadBuffer(SelectableChannel ch) {
        this.ch = ch;
        this.buf = ByteBuffer.allocateDirect(BUF_SIZE);
    }

    public SelectableChannel ch() {
        return this.ch;
    }

    public ByteBuffer buf() {
        return this.buf;
    }
}


@@ -78,33 +78,97 @@
 hannels.
-SelectableChannel
+Channel;%0Aimport java.nio.channels.ReadableByteChannel;%0Aimport java.io.IOException
 ;%0A%0Apubli
@@ -253,26 +253,16 @@
 private 
-Selectable
 Channel 
@@ -323,26 +323,16 @@
 dBuffer(
-Selectable
 Channel 
@@ -437,18 +437,8 @@
 lic 
-Selectable
 Chan
@@ -540,11 +540,236 @@
 ;%0A    %7D%0A
+%0A    public int read() throws IOException %7B%0A        ReadableByteChannel c = (ReadableByteChannel)this.ch;%0A        return c.read(this.buf);%0A    %7D%0A%0A    public boolean isRemaining() %7B%0A        return this.buf.limit() %3E 0;%0A    %7D%0A%0A
 %7D%0A%0A

modify member type SelectableChannel to Channel and add some methods in class ChannelReadBuffer