You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2006/01/12 21:02:49 UTC

DO NOT REPLY [Bug 38246] New: - BinaryCodec.toAsciiString outputs answer in reverse byte order.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38246>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38246

           Summary: BinaryCodec.toAsciiString outputs answer in reverse byte
                    order.
           Product: Commons
           Version: 1.3 Final
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Codec
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: albertcin@excite.com


In Codec 1.3,
BinaryCodec.toAsciiString outputs answer in reverse byte order.  For example:
byte [0,1,2] becomes [00000010,00000001,00000000].

BeanShell output:

BinaryCodec.toAsciiString reverses the input byte array.
bsh % hex = "0077FF";
<0077FF>
bsh % bytes = Hex.decodeHex(hex.toCharArray());
<[B...@1d520c4>
bsh % bytes[0];
<0>
bsh % bytes[1];
<119>
bsh % bytes[2];
<-1>
bsh % BinaryCodec.toAsciiString(bytes);
<111111110111011100000000>

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 38246] - [codec] BinaryCodec.toAsciiString outputs answer in reverse byte order.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38246>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38246


gudnabrsam@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|BinaryCodec.toAsciiString   |[codec]
                   |outputs answer in reverse   |BinaryCodec.toAsciiString
                   |byte order.                 |outputs answer in reverse
                   |                            |byte order.




-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


DO NOT REPLY [Bug 38246] - [codec] BinaryCodec.toAsciiString outputs answer in reverse byte order.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=38246>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=38246


tobrien@discursive.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From tobrien@discursive.com  2006-01-13 02:37 -------
This is expected behavior.  toAsciiString() prints a L->R readable String
representation of a single value contained in a series of bytes.

So, if you put the numeric values [0,1,2] in a byte array, you end up with the
correct result, which is:

2^8 + 2^17 

(which in binary is represented by)

100000000100000000

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org