[869] in java-interest

home help back first fref pref prev next nref lref last post

Re: Byte buf to string value ?

daemon@ATHENA.MIT.EDU (Jonathan Payne)
Sat Aug 12 01:33:37 1995

Date: Fri, 11 Aug 1995 16:35:30 -0700
From: jpayne@starwave.com (Jonathan Payne)
To: chanda@PRPA.Philips.COM
Cc: java-interest@java.sun.com
In-Reply-To: <9508112118.AA26302@annex.PRPA.Philips.COM> (chanda@PRPA.Philips.COM)

byte data[];

String s = new String(data);

or

String s = new String(data, 0, 0, length);

but not

String s = new String(data, length);

The last one creates a String from the data bytes, with the upper byte
of the 16-bit char set to "length".  It's a common mistake.
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post