Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Jul 29, 2026. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork 6.4k
JSON_writeJSONString_cn
wenshao edited this page May 2, 2016
·
2 revisions
在1.2.11版本中,JSON类新增对OutputStream/Writer直接支持。
packagecom.alibaba.fastjson;
publicabstractclassJSON {
publicstaticfinalintwriteJSONString(OutputStreamos, // Objectobject, // SerializerFeature... features) throwsIOException;
publicstaticfinalintwriteJSONString(OutputStreamos, //Charsetcharset, // Objectobject, // SerializerFeature... features) throwsIOException;
publicstaticfinalintwriteJSONString(Writeros, // Objectobject, // SerializerFeature... features) throwsIOException;
}importcom.alibaba.fastjson;
importjava.nio.charset.Charset;
classModel {
publicintvalue;
}
Modelmodel = newModel();
model.value = 1001;
OutputStreamos = ...;
JSON.writeJSONString(os, model);
JSON.writeJSONString(os, Charset.from("GB18030"), model);
Writerwriter = ...;
JSON.writeJSONString(os, model);如有需要修改本注脚,请联系阿里巴巴,
© 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