This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
JSONValidator
温绍锦 edited this page Sep 5, 2019
·
1 revision
1.2.60新增加一个高性能校验JSON字符串的API,还在验证阶段,欢迎试用。支持输入类型是字符串、byte数组、InputStream、Reader。
package com.alibaba.fastjson;
public abstract class JSONValidator {
// 支持输入类型是utf8编码的byte[]、String、InputStream、Reader
public static JSONValidator fromUtf8(byte[] jsonBytes)
public static JSONValidator fromUtf8(InputStream is)
public static JSONValidator from(String str)
public static JSONValidator from(Reader r)
public boolean validate();
}
String jsonStr = ...
JSONValidator validator = JSONValidator.from(jsonStr);
boolean valid = validator.validate();
输入参数是byte[]时,只支持UTF8编码
byte[] jsonBytes = ...
JSONValidator validator = JSONValidator.fromUtf8(jsonBytes);
boolean valid = validator.validate();
输入参数是InputSteam时,只支持UTF8编码
InputStream is = ...
JSONValidator validator = JSONValidator.fromUtf8(is);
boolean valid = validator.validate();
Reader r = ...
JSONValidator validator = JSONValidator.from(r);
boolean valid = validator.validate();
如有需要修改本注脚,请联系阿里巴巴,
© Alibaba Fastjson Develop Team
注明: 版权所有阿里巴巴,请注明版权所有者
If you need to amend this footnote, please contact Alibaba.
© Alibaba Fastjson Develop Team
Note: Copyright Alibaba, please indicate the copyright owner