Fastjson中writeJSONString方法具有什么功能呢?
									
下文笔者将讲述writeJSONString方法的功能简介说明,如下所示
				 
				writeJSONString方法的功能
将实体信息直接采用json字符串的形式写入到流中
writeJSONString方法源码
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 = 8998;
OutputStream os = ...;
JSON.writeJSONString(os, model);
JSON.writeJSONString(os, Charset.from("GB18030"), model);
Writer writer = ...;
JSON.writeJSONString(os, model);
									
版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。

			
               
               
               
               
          
