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
JSON_writeJSONString_cn
wenshao edited this page May 2, 2016
·
2 revisions
在1.2.11版本中,JSON类新增对OutputStream/Writer直接支持。
package com.alibaba.fastjson;
public abstract class JSON {
public static final int writeJSONString(OutputStream os, //
Object object, //
SerializerFeature... features) throws IOException;
public static final int writeJSONString(OutputStream os, //
Charset charset, //
Object object, //
SerializerFeature... features) throws IOException;
public static final int writeJSONString(Writer os, //
Object object, //
SerializerFeature... features) throws IOException;
}
import com.alibaba.fastjson;
import java.nio.charset.Charset;
class Model {
public int value;
}
Model model = new Model();
model.value = 1001;
OutputStream os = ...;
JSON.writeJSONString(os, model);
JSON.writeJSONString(os, Charset.from("GB18030"), model);
Writer writer = ...;
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