Streaming to file

Trustin Lee (이희승) trustin at gmail.com
Sat Nov 7 02:35:35 EST 2009


Hi David,

ChannelBuffer.getBytes(int index, GatheringByteChannel out, int length)
ChannelBuffer.getBytes(int index, OutputStream out, int length)
ChannelBuffer.readBytes(GatheringByteChannel out, int length)
ChannelBuffer.readBytes(OutputStream out, int length)

are what you are looking for. :)

— Trustin Lee, http://gleamynode.net/

On Sat, Nov 7, 2009 at 1:57 AM, Hoyt, David <hoyt6 at llnl.gov> wrote:
> 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
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
>



More information about the netty-users mailing list