ChannelBuffer to byte array

Shay Banon kimchy at gmail.com
Wed Mar 3 03:00:54 EST 2010


Just to clarify this (and correct me if I am wrong here Trustin), if then,
you are going to use that byte array in another thread (for example, using
the execution handler), then you have to copy it over. For example, in your
http request message handler which then delegates the handling of the Http
request to another thread.

-shay.banon

On Wed, Mar 3, 2010 at 7:56 AM, "Trustin Lee (이희승)" <trustin at gmail.com>wrote:

> Adam,
>
> Netty 3.2 adds array() and hasArray() to ChannelBuffer.
>
> In 3.1, you can call toByteBuffer() which will not involve memory copy
> if possible.
>
> HTH,
> Trustin
>
> Adam Durana wrote:
> > Hi,
> >
> > I'm looking for the most efficient way to get a ChannelBuffer's data
> > in the form of a byte array.  The byte array will be only read from
> > and not modified.  Is the best way to use a ChannelBuffer's readBytes
> > method to copy the data into an array?  Or is there a way that doesn't
> > involve copying given that I'm not going to be modifying the array?
> >
> > Thanks,
> > Adam
> > _______________________________________________
> > netty-users mailing list
> > netty-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/netty-users
>
> --
> what we call human nature in actuality is human habit
> http://gleamynode.net/
>
>
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/netty-users/attachments/20100303/9e1f9166/attachment.html 


More information about the netty-users mailing list