mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
Changes for better memory managment
This commit is contained in:
parent
f6a52e260b
commit
f39469e71c
@ -185,7 +185,7 @@ public final class String
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static Object decodeUTF8(byte[] s8, int offset, int length) {
|
private static Object decodeUTF8(byte[] s8, int offset, int length) {
|
||||||
Object buf = new byte[s8.length];
|
Object buf = new byte[length];
|
||||||
boolean isMultiByte = false;
|
boolean isMultiByte = false;
|
||||||
int i=offset, j=0;
|
int i=offset, j=0;
|
||||||
while(i < offset+length) {
|
while(i < offset+length) {
|
||||||
@ -195,14 +195,14 @@ public final class String
|
|||||||
decodeUTF8_insert(buf, j++, x);
|
decodeUTF8_insert(buf, j++, x);
|
||||||
} else if((x & 0x0e0) == 0x0c0) { // 2 byte char
|
} else if((x & 0x0e0) == 0x0c0) { // 2 byte char
|
||||||
if(!isMultiByte) {
|
if(!isMultiByte) {
|
||||||
buf = decodeUTF8_widen(buf, j, s8.length-1);
|
buf = decodeUTF8_widen(buf, j, length-1);
|
||||||
isMultiByte = true;
|
isMultiByte = true;
|
||||||
}
|
}
|
||||||
int y = s8[i++];
|
int y = s8[i++];
|
||||||
decodeUTF8_insert(buf, j++, ((x & 0x1f) << 6) | (y & 0x3f));
|
decodeUTF8_insert(buf, j++, ((x & 0x1f) << 6) | (y & 0x3f));
|
||||||
} else if((x & 0x0f0) == 0x0e0) { // 3 byte char
|
} else if((x & 0x0f0) == 0x0e0) { // 3 byte char
|
||||||
if(!isMultiByte) {
|
if(!isMultiByte) {
|
||||||
buf = decodeUTF8_widen(buf, j, s8.length-2);
|
buf = decodeUTF8_widen(buf, j, length-2);
|
||||||
isMultiByte = true;
|
isMultiByte = true;
|
||||||
}
|
}
|
||||||
int y = s8[i++]; int z = s8[i++];
|
int y = s8[i++]; int z = s8[i++];
|
||||||
|
Loading…
Reference in New Issue
Block a user