[JBoss JIRA] Commented: (NETTY-228) Method "ChannelBuffers.wrappedBuffer(ByteBuffer buffer)" does not always honor ByteOrder

Trustin Lee (JIRA) jira-events at lists.jboss.org
Fri Sep 25 03:07:03 EDT 2009


    [ https://jira.jboss.org/jira/browse/NETTY-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12487361#action_12487361 ] 

Trustin Lee commented on NETTY-228:
-----------------------------------

Hi Ben, could you elaborate with me on your last sentence?  'A read-only buffer can change its endianess.'  Where in Javadoc are you referring?

> Method "ChannelBuffers.wrappedBuffer(ByteBuffer buffer)" does not always honor ByteOrder
> ----------------------------------------------------------------------------------------
>
>                 Key: NETTY-228
>                 URL: https://jira.jboss.org/jira/browse/NETTY-228
>             Project: Netty
>          Issue Type: Bug
>          Components: Buffer
>    Affects Versions: 3.1.3.GA
>            Reporter: xjn xjn
>            Assignee: Trustin Lee
>             Fix For: 3.1.4.GA
>
>
> This results sonetimes in wrong buffer ByteOrder on using NioDatagramChannelFactory with "bufferFactory" set to LITTLE_ENDIAN  Factories
> ChannelBuffers Rev 1685 Line 296
> 296             return wrappedBuffer(buffer.array(), buffer.arrayOffset(),buffer.remaining());
> should be changed to
> 296             return wrappedBuffer(buffer.order(), buffer.array(), buffer.arrayOffset(),buffer.remaining());
> public static ChannelBuffer wrappedBuffer(ByteBuffer buffer) {
> 292         if (!buffer.hasRemaining()) {
> 293             return EMPTY_BUFFER;
> 294         }
> 295         if (!buffer.isReadOnly() && buffer.hasArray()) {
> 296             return wrappedBuffer(buffer.array(), buffer.arrayOffset(),buffer.remaining());
> 297         } else {
> 298             return new ByteBufferBackedChannelBuffer(buffer);
> 299         }
> 300     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the netty-dev mailing list