aspose file tools*
The moose likes I/O and Streams and the fly likes new String(byte[]) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "new String(byte[])" Watch "new String(byte[])" New topic
Author

new String(byte[])

Kejal Shah
Ranch Hand

Joined: Jun 27, 2003
Posts: 87
I pass a byte array to create a new String object. However, the byte representation of this new string is different from the one I pass it.

One of the bytes in the passed byte array is 0x90 or 144. However, in the string object tat i retrieve, this byte is 63!

Tx in adv
Kejal
[ February 23, 2005: Message edited by: Kejal Shah ]

Kejal<br />SaneDevil@gmail.com
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8927
    
    9

A String is supposed to represent characters, not the full range of the char data type. I would wager that the value you are attempting to set cannot be represented in your default charset so it gets substituted. For further info, read up on java.nio.charset.Charset and look up your local Unicode code chart


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: new String(byte[])