Streaming to file

Hoyt, David hoyt6 at llnl.gov
Fri Nov 6 11:57:47 EST 2009


What's the best way to get a ChannelBuffer into a file? I just want to dump the incoming bytes into a file.

I'm using NIO and I have a FileChannel and I'm just calling "myFileChannel.write(myChannelBuffer.toByteBuffer()); myFileChannel.flush();" - is that right? Is there a better way?

Is there a way to have my incoming ChannelBuffers automagically be a ByteBuffer without having additional overhead of calling .toByteBuffer() and risking byte copying?

Thanks,
- David Hoyt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20091106/64266094/attachment.html 


More information about the netty-users mailing list