Package com.alibaba.fastjson

Examples of com.alibaba.fastjson.JSONStreamAware


    public static JSONStreamAwareSerializer instance = new JSONStreamAwareSerializer();

    public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {
        SerializeWriter out = serializer.getWriter();

        JSONStreamAware aware = (JSONStreamAware) object;
        aware.writeJSONString(out);
    }
View Full Code Here


        Assert.assertEquals("null", serializer.getWriter().toString());
    }

    public void test_4() throws Exception {
        JSONSerializer serializer = new JSONSerializer();
        serializer.write(new JSONStreamAware() {

            public void writeJSONString(Appendable out) throws IOException {
                out.append("abc");
            }
        });
View Full Code Here

        JSONException error = null;
        try {
            StringWriter out = new StringWriter();

            JSONSerializer serializer = new JSONSerializer();
            serializer.write(new JSONStreamAware() {

                public void writeJSONString(Appendable out) throws IOException {
                    throw new IOException();
                }
            });
View Full Code Here

        Assert.assertEquals("null", serializer.getWriter().toString());
    }

    public void test_4() throws Exception {
        JSONSerializer serializer = new JSONSerializer();
        serializer.write(new JSONStreamAware() {

            public void writeJSONString(Appendable out) throws IOException {
                out.append("abc");
            }
        });
View Full Code Here

        JSONException error = null;
        try {
            StringWriter out = new StringWriter();

            JSONSerializer serializer = new JSONSerializer();
            serializer.write(new JSONStreamAware() {

                public void writeJSONString(Appendable out) throws IOException {
                    throw new IOException();
                }
            });
View Full Code Here

TOP

Related Classes of com.alibaba.fastjson.JSONStreamAware

Copyright © 2018 www.massapicom. 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.