Package cn.net.pap.common.jsonorm.parser
Class OptimizedJsonParser
java.lang.Object
cn.net.pap.common.jsonorm.parser.OptimizedJsonParser
高效JSON解析工具类,通过字符串池和数字常量池优化内存使用
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddDoubleConstant(double constant) 添加预定义双精度浮点数常量static voidaddIntegerConstant(int constant) 添加预定义整数常量static voidaddLongConstant(long constant) 添加预定义长整型常量static voidaddStringConstant(String constant) 添加预定义字符串常量static voidparseLargeFileWithOptimization(File jsonFile, OptimizedJsonParser.JsonHandler handler) 流式解析JSON文件,适用于大文件static <T> TparseWithOptimization(String json, Class<T> valueType) 带常量池优化的反序列化方法static DoublepoolDouble(double value) 双精度浮点数池化方法static IntegerpoolInteger(int value) 整数池化方法static LongpoolLong(long value) 长整型池化方法static StringpoolString(String value) 字符串池化方法
-
Constructor Details
-
OptimizedJsonParser
public OptimizedJsonParser()
-
-
Method Details
-
parseWithOptimization
带常量池优化的反序列化方法- Throws:
IOException
-
parseLargeFileWithOptimization
public static void parseLargeFileWithOptimization(File jsonFile, OptimizedJsonParser.JsonHandler handler) throws IOException 流式解析JSON文件,适用于大文件- Throws:
IOException
-
poolString
字符串池化方法 -
addStringConstant
添加预定义字符串常量 -
poolInteger
整数池化方法 -
addIntegerConstant
public static void addIntegerConstant(int constant) 添加预定义整数常量 -
poolLong
长整型池化方法 -
addLongConstant
public static void addLongConstant(long constant) 添加预定义长整型常量 -
poolDouble
双精度浮点数池化方法 -
addDoubleConstant
public static void addDoubleConstant(double constant) 添加预定义双精度浮点数常量
-