@SuppressWarnings("unchecked") public static final <T> T parseObject( byte[] input, int off, int len, CharsetDecoder charsetDecoder, Type clazz, Feature... features) { charsetDecoder.reset(); int scaleLength = (int) (len * (double) charsetDecoder.maxCharsPerByte()); char[] chars = ThreadLocalCache.getChars(scaleLength); ByteBuffer byteBuf = ByteBuffer.wrap(input, off, len); CharBuffer charByte = CharBuffer.wrap(chars); IOUtils.decode(charsetDecoder, byteBuf, charByte); int position = charByte.position(); return (T) parseObject(chars, position, clazz, features); }
public static final Object parse( byte[] input, int off, int len, CharsetDecoder charsetDecoder, int features) { charsetDecoder.reset(); int scaleLength = (int) (len * (double) charsetDecoder.maxCharsPerByte()); char[] chars = ThreadLocalCache.getChars(scaleLength); ByteBuffer byteBuf = ByteBuffer.wrap(input, off, len); CharBuffer charBuf = CharBuffer.wrap(chars); IOUtils.decode(charsetDecoder, byteBuf, charBuf); int position = charBuf.position(); DefaultJSONParser parser = new DefaultJSONParser(chars, position, ParserConfig.getGlobalInstance(), features); Object value = parser.parse(); parser.handleResovleTask(value); parser.close(); return value; }
@SuppressWarnings("unchecked") public static final <T> T parseObject(byte[] input, Type clazz, Feature... features) { return (T) parseObject(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), clazz, features); }
public static final Object parse(byte[] input, Feature... features) { return parse(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), features); }