public static <T> T parse(String s, JsonGeneric<T> generic) { s = s.trim(); char[] data = StringReflection.chars(s); int offset = 0; if (data.length != s.length()) offset = StringReflection.offset(s); // for java 6 return parse(data, offset, offset + s.length(), generic); }
public void write(String s, int off, int l) throws IOException { int offset = StringReflection.offset(s) + off; char[] chars = StringReflection.chars(s); write(chars, offset, l); }
public void write(String s, int off, int l) throws IOException { int offset = StringReflection.offset(s) + off; char[] chars = StringReflection.chars(s); write(chars, offset, l); }
static void escape(String s, Appender sb) { char[] chars = StringReflection.chars(s); int to = s.length(); int offset = chars.length == to ? 0 : StringReflection.offset(s); int from = offset; to += from; int l = to - 1; for (int i = from; i < l; i += 2) { from = check(from, i, chars, sb); from = check(from, i + 1, chars, sb); //about 10% faster } if ((l + offset) % 2 == 0) from = check(from, l, chars, sb); if (from < to) append(chars, from, to, sb); }
int length = s.length(); char[] chars = StringReflection.chars(s); int i = length == chars.length ? 0 : StringReflection.offset(s); int year, month, day; year = getInt4(chars, i);
int length = s.length(); char[] chars = StringReflection.chars(s); int i = length == chars.length ? 0 : StringReflection.offset(s); int year, month, day; year = getInt4(chars, i);