Closed GoogleCodeExporter closed 8 years ago
try that:
byte[] bytes;
String charset = "ANSI";
JSONValue.parse(new String(bytes, beginIndex, endIndex, charset));
the performance improvement should be the same due to Json-smart internal
String optimisations.
Original comment by uriel.chemouni
on 11 May 2012 at 4:25
This is not the same, new String () will cause the bytes to be copied,
definitions of detailed below:
public String(byte bytes[], int offset, int length, String charsetName)
throws UnsupportedEncodingException
{
if (charsetName == null)
throw new NullPointerException("charsetName");
checkBounds(bytes, offset, length);
char[] v = StringCoding.decode(charsetName, bytes, offset, length);
this.offset = 0;
this.count = v.length;
this.value = v;
}
The size of the bytes in my program more than 10k bytes, so it's a great
influence on my program
Original comment by runner....@gmail.com
on 14 May 2012 at 2:07
so ...
you're right.
Original comment by uriel.chemouni
on 23 Jun 2012 at 4:32
public Object parse(byte[] in, int offset, int length);
is now avaiable in Json-smart V1
build json-smart from git, or wait for V 1.1.2
Original comment by uriel.chemouni
on 23 Jun 2012 at 4:53
Original issue reported on code.google.com by
runner....@gmail.com
on 11 May 2012 at 2:13