Skip to content
This repository was archived by the owner on Jul 29, 2026. It is now read-only.

JSON_parseObject_InputStream_cn

wenshao edited this page May 2, 2016 · 1 revision

在1.2.11版本中,fastjson新增加了对InputStream的支持支持。

packagecom.alibaba.fastjson;
publicabstractclassJSON {
publicstatic <T> TparseObject(InputStreamis, //Typetype, //Feature... features) throwsIOException;
publicstatic <T> TparseObject(InputStreamis, //Charsetcharset, //Typetype, //Feature... features) throwsIOException;
}

Sample

importcom.alibaba.fastjson;
importjava.nio.charset.Charset;
classModel {
publicintvalue;
}
InputStreamis = ...
Modelmodel = JSON.parseObject(is, Model.class);
Modelmodel2 = JSON.parseObject(is, Charset.from("UTF-8"), Model.class);

Clone this wiki locally