@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);
}
java类com.alibaba.fastjson.util.ThreadLocalCache的实例源码
JSON.java 文件源码
项目:uavstack
阅读 32
收藏 0
点赞 0
评论 0
AlibabaJsonSerializer.java 文件源码
项目:navi
阅读 27
收藏 0
点赞 0
评论 0
private <T> T toParseObject(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Type clazz) {
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();
if (chars.length == 0) {
return null;
}
DefaultJSONParser parser = new DefaultJSONParser(chars, position, parseConfig, DEFAULT_PARSER_FEATURE);
T value = parser.parseObject(clazz);
parser.handleResovleTask(value);
parser.close();
return value;
}
JSON.java 文件源码
项目:itmarry
阅读 31
收藏 0
点赞 0
评论 0
@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);
}
JSON.java 文件源码
项目:android_http_demo
阅读 31
收藏 0
点赞 0
评论 0
@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);
}
JSON.java 文件源码
项目:AndroidNio
阅读 35
收藏 0
点赞 0
评论 0
@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);
}
SerialWriterStringEncoder.java 文件源码
项目:boohee_v5.6
阅读 26
收藏 0
点赞 0
评论 0
public byte[] encode(char[] chars, int off, int len) {
if (len == 0) {
return new byte[0];
}
this.encoder.reset();
return encode(chars, off, len, ThreadLocalCache.getBytes(scale(len, this.encoder.maxBytesPerChar())));
}
JSON.java 文件源码
项目:boohee_v5.6
阅读 34
收藏 0
点赞 0
评论 0
public static final Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, int features) {
charsetDecoder.reset();
char[] chars = ThreadLocalCache.getChars((int) (((double) len) * ((double) charsetDecoder.maxCharsPerByte())));
ByteBuffer byteBuf = ByteBuffer.wrap(input, off, len);
CharBuffer charBuf = CharBuffer.wrap(chars);
IOUtils.decode(charsetDecoder, byteBuf, charBuf);
DefaultJSONParser parser = new DefaultJSONParser(chars, charBuf.position(), ParserConfig.getGlobalInstance(), features);
Object value = parser.parse();
parser.handleResovleTask(value);
parser.close();
return value;
}
JSON.java 文件源码
项目:boohee_v5.6
阅读 36
收藏 0
点赞 0
评论 0
public static final <T> T parseObject(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Type clazz, Feature... features) {
charsetDecoder.reset();
char[] chars = ThreadLocalCache.getChars((int) (((double) len) * ((double) charsetDecoder.maxCharsPerByte())));
ByteBuffer byteBuf = ByteBuffer.wrap(input, off, len);
CharBuffer charByte = CharBuffer.wrap(chars);
IOUtils.decode(charsetDecoder, byteBuf, charByte);
return parseObject(chars, charByte.position(), clazz, features);
}
AlibabaJsonSerializer.java 文件源码
项目:navi
阅读 36
收藏 0
点赞 0
评论 0
@SuppressWarnings("unchecked")
public <T> T getObjectFromBytes(byte[] input, Class<T> clazz) {
if (input == null) {
return null;
} else if (String.class.equals(clazz)) {
return (T) new String(input, Charset.forName("UTF8"));
}
return toParseObject(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), clazz);
}
ThreadLocalCacheTest.java 文件源码
项目:GitHub
阅读 24
收藏 0
点赞 0
评论 0
public void test_threadCache() throws Exception {
ThreadLocalCache.getBytes(10);
}
JSON.java 文件源码
项目:boohee_v5.6
阅读 32
收藏 0
点赞 0
评论 0
public static final Object parse(byte[] input, Feature... features) {
return parse(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), features);
}
JSON.java 文件源码
项目:boohee_v5.6
阅读 31
收藏 0
点赞 0
评论 0
public static final <T> T parseObject(byte[] input, Type clazz, Feature... features) {
return parseObject(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), clazz, features);
}
JSON.java 文件源码
项目:uavstack
阅读 30
收藏 0
点赞 0
评论 0
public static final Object parse(byte[] input, Feature... features) {
return parse(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), features);
}
JSON.java 文件源码
项目:uavstack
阅读 30
收藏 0
点赞 0
评论 0
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;
}
JSON.java 文件源码
项目:uavstack
阅读 34
收藏 0
点赞 0
评论 0
@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);
}
JSON.java 文件源码
项目:itmarry
阅读 29
收藏 0
点赞 0
评论 0
public static final Object parse(byte[] input, Feature... features) {
return parse(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), features);
}
JSON.java 文件源码
项目:itmarry
阅读 36
收藏 0
点赞 0
评论 0
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();
handleResovleTask(parser, value);
parser.close();
return value;
}
JSON.java 文件源码
项目:itmarry
阅读 33
收藏 0
点赞 0
评论 0
@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);
}
JSON.java 文件源码
项目:android_http_demo
阅读 37
收藏 0
点赞 0
评论 0
public static final Object parse(byte[] input, Feature... features) {
return parse(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), features);
}
JSON.java 文件源码
项目:android_http_demo
阅读 36
收藏 0
点赞 0
评论 0
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();
handleResovleTask(parser, value);
parser.close();
return value;
}
JSON.java 文件源码
项目:android_http_demo
阅读 28
收藏 0
点赞 0
评论 0
@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);
}
JSON.java 文件源码
项目:AndroidNio
阅读 26
收藏 0
点赞 0
评论 0
public static final Object parse(byte[] input, Feature... features) {
return parse(input, 0, input.length, ThreadLocalCache.getUTF8Decoder(), features);
}
JSON.java 文件源码
项目:AndroidNio
阅读 33
收藏 0
点赞 0
评论 0
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();
handleResovleTask(parser, value);
parser.close();
return value;
}
JSON.java 文件源码
项目:AndroidNio
阅读 31
收藏 0
点赞 0
评论 0
@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);
}
SerialWriterStringEncoder.java 文件源码
项目:uavstack
阅读 32
收藏 0
点赞 0
评论 0
public byte[] encode(char[] chars, int off, int len) {
if (len == 0) {
return new byte[0];
}
encoder.reset();
int bytesLength = scale(len, encoder.maxBytesPerChar());
byte[] bytes = ThreadLocalCache.getBytes(bytesLength);
return encode(chars, off, len, bytes);
}
SerialWriterStringEncoder.java 文件源码
项目:itmarry
阅读 27
收藏 0
点赞 0
评论 0
public byte[] encode(char[] chars, int off, int len) {
if (len == 0) {
return new byte[0];
}
encoder.reset();
int bytesLength = scale(len, encoder.maxBytesPerChar());
byte[] bytes = ThreadLocalCache.getBytes(bytesLength);
return encode(chars, off, len, bytes);
}
SerialWriterStringEncoder.java 文件源码
项目:android_http_demo
阅读 26
收藏 0
点赞 0
评论 0
public byte[] encode(char[] chars, int off, int len) {
if (len == 0) {
return new byte[0];
}
encoder.reset();
int bytesLength = scale(len, encoder.maxBytesPerChar());
byte[] bytes = ThreadLocalCache.getBytes(bytesLength);
return encode(chars, off, len, bytes);
}
SerialWriterStringEncoder.java 文件源码
项目:AndroidNio
阅读 25
收藏 0
点赞 0
评论 0
public byte[] encode(char[] chars, int off, int len) {
if (len == 0) {
return new byte[0];
}
encoder.reset();
int bytesLength = scale(len, encoder.maxBytesPerChar());
byte[] bytes = ThreadLocalCache.getBytes(bytesLength);
return encode(chars, off, len, bytes);
}