Access the WriteableByteChannel
Norman Maurer
norman at apache.org
Wed Jan 19 01:59:05 EST 2011
So just to keep the loop. I wrote my own WriteableByteChannel implementation
which just write the stuff to the Channel.
public class ChannelWritableByteChannel implements WritableByteChannel {
private final Channel channel;
public ChannelWritableByteChannel(Channel channel) {
this.channel = channel;
}
public void close() throws IOException {
// do nothing
}
public boolean isOpen() {
return channel.isOpen();
}
/*
* (non-Javadoc)
* @see java.nio.channels.WritableByteChannel#write(java.nio.ByteBuffer)
*/
public int write(ByteBuffer src) throws IOException {
if (src.remaining() == 0) return 0;
byte data[] = new byte[src.remaining()];
src.get(data);
channel.write(ChannelBuffers.wrappedBuffer(data));
return data.length;
}
}
Maybe helpful for someone
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Access-the-WriteableByteChannel-tp5917734p5938490.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list