Package com.alibaba.fastjson

Examples of com.alibaba.fastjson.JSONWriter.startArray()


public class JSONWriterTest_0 extends TestCase {

    public void test_writer() throws Exception {
        StringWriter out = new StringWriter();
        JSONWriter writer = new JSONWriter(out);
        writer.startArray();
        writer.writeObject("1");
        writer.writeObject("2");
        writer.writeObject("3");
        writer.endArray();
        writer.close();
View Full Code Here


        SectionRequest req = new SectionRequest();
        req.setScreenHeight(100);// 父类中的属性
        req.setScreenWidth(12);// 父类中的属性
        req.setTag("11");
        JSONWriter writer = new JSONWriter(strWriter);
        writer.startArray();
        writer.writeObject(req);
        writer.endArray();
        writer.close();
       
        String text = strWriter.toString();
View Full Code Here

        data.put("one", one);
        data.put("two", two);

        StringWriter jsonStr = new StringWriter();
        JSONWriter writer = new JSONWriter(jsonStr);//超大文本写入
        writer.startArray();
        writer.writeValue(one);
        writer.writeValue(two);
        writer.endArray();
        try {
            writer.close();
View Full Code Here

        for (int i = 0; i < 100 * 1; ++i) {
            list.add(Integer.toString(i));
        }
        File file = File.createTempFile("fastjson-stream-large", "json");
        JSONWriter writer = new JSONWriter(new FileWriter(file));
        writer.startArray();
        writer.writeObject(list);
        writer.endArray();
        writer.close();

        System.out.println(FileUtils.readFileToString(file));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.