W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
Fastjson 在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);
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: