There was an error while loading. Please reload this page.
在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; }
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);