Package blackberry.common.util.json4j.internal

Examples of blackberry.common.util.json4j.internal.JSON4JStringWriter


     *
     * @throws JSONException Thrown on errors during serialization.
     */
    public String write(int indentDepth) throws JSONException {
        Serializer serializer;
        JSON4JStringWriter writer = new JSON4JStringWriter();

        if (indentDepth < 1) {
            indentDepth = 0;
        } else if (indentDepth > 8) {
            indentDepth = 9;
        }

        if (indentDepth > 0) {
            serializer = new SerializerVerbose(writer, indentDepth);
        } else {
            serializer = new Serializer(writer);
        }
        try {
            serializer.writeObject(this).flush();
        } catch (IOException iox) {
            JSONException jex = new JSONException("Error occurred during write.");
            jex.setCause(iox);
            throw jex;
        }
        return writer.toString();
    }
View Full Code Here


     *
     * @throws JSONException Thrown on errors during serialization.
     */
    public String write(boolean verbose) throws JSONException {
        Serializer serializer;
        JSON4JStringWriter writer = new JSON4JStringWriter();

        if (verbose) {
            serializer = new SerializerVerbose(writer);
        } else {
            serializer = new Serializer(writer);
        }
        try {
            serializer.writeObject(this).flush();
        } catch (IOException iox) {
            JSONException jex = new JSONException("Error occurred during write.");
            jex.setCause(iox);
            throw jex;
        }
        return writer.toString();
    }
View Full Code Here

     *
     * @throws JSONException Thrown on IO errors during serialization.
     */
    public String write(boolean verbose) throws JSONException {
        Serializer serializer;
        JSON4JStringWriter writer = new JSON4JStringWriter();

        if (verbose) {
            serializer = new SerializerVerbose(writer);
        } else {
            serializer = new Serializer(writer);
        }
        try {
            serializer.writeArray(this).flush();
        } catch (IOException iox) {
            JSONException jex = new JSONException("Error occurred during input read.");
            jex.setCause(iox);
            throw jex;
        }
        return writer.toString();
    }
View Full Code Here

     *
     * @throws JSONException Thrown on IO errors during serialization.
     */
    public String write(int indentDepth) throws JSONException {
        Serializer serializer;
        JSON4JStringWriter writer = new JSON4JStringWriter();

        if (indentDepth < 1) {
            indentDepth = 0;
        } else if (indentDepth > 8) {
            indentDepth = 9;
        }

        if (indentDepth > 0) {
            serializer = new SerializerVerbose(writer, indentDepth);
        } else {
            serializer = new Serializer(writer);
        }
        try {
            serializer.writeArray(this).flush();
        } catch (IOException iox) {
            JSONException jex = new JSONException("Error occurred during input read.");
            jex.setCause(iox);
            throw jex;
        }
        return writer.toString();
    }
View Full Code Here

* JSON parsers.
*/
public class JSONStringer extends JSONWriter {

    public JSONStringer() {
        super(new JSON4JStringWriter());
    }
View Full Code Here

TOP

Related Classes of blackberry.common.util.json4j.internal.JSON4JStringWriter

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.