Reading bytes from ChannelBuffer, writing with RandomAccessFile

bgoetzmann bgoetzmann at sophia.symag.com
Fri Sep 11 12:15:01 EDT 2009


Hello,

In my custom handler's messageReceived, I would like write bytes contained
in the ChannelBuffer instance into a file using a RandomAccessFile instance;
so, a simple approach could be (where raf is the RandomAccessFile
reference):

ChannelBuffer buf = (ChannelBuffer) e.getMessage();
while(buf.readable()) {
    raf.writeByte(buf.readByte());
}

It works, but I think there is a more quick approach! Any idea?

Thank you.

Bertrand.
-- 
View this message in context: http://n2.nabble.com/Reading-bytes-from-ChannelBuffer-writing-with-RandomAccessFile-tp3626803p3626803.html
Sent from the Netty User Group mailing list archive at Nabble.com.


More information about the netty-users mailing list