org.xerial.json
Class JSONWriter

java.lang.Object
  extended by org.xerial.json.JSONWriter

public class JSONWriter
extends Object

A support class for generating JSON data

Author:
leo

Constructor Summary
JSONWriter(Writer writer)
           
 
Method Summary
 void add(boolean bool)
           
 void add(double value)
           
 void add(float value)
           
 void add(int value)
           
 void add(long value)
           
 void add(String value)
           
 void append(String stringFragment)
           
 void endArray()
           
 void endJSON()
           
 void endObject()
           
 void endString()
           
 void flush()
           
 Writer getWriter()
           
 void put(String key, boolean value)
           
 void put(String key, double value)
           
 void put(String key, float value)
           
 void put(String key, int value)
           
 void put(String key, long value)
           
 void put(String key, String value)
           
 void putNull(String key)
           
 void putString(String key, Reader input)
          Generate the key/value pair from the Reader
 void startArray()
           
 void startArray(String key)
           
 void startObject()
           
 void startString()
           
 void startString(String key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONWriter

public JSONWriter(Writer writer)
Method Detail

startObject

public void startObject()
                 throws IOException
Throws:
IOException

endObject

public void endObject()
               throws IOException,
                      JSONException
Throws:
IOException
JSONException

startArray

public void startArray()
                throws IOException
Throws:
IOException

endArray

public void endArray()
              throws IOException,
                     JSONException
Throws:
IOException
JSONException

startString

public void startString()
                 throws JSONException,
                        IOException
Throws:
JSONException
IOException

startString

public void startString(String key)
                 throws JSONException,
                        IOException
Throws:
JSONException
IOException

append

public void append(String stringFragment)
            throws JSONException,
                   IOException
Throws:
JSONException
IOException

endString

public void endString()
               throws JSONException,
                      IOException
Throws:
JSONException
IOException

startArray

public void startArray(String key)
                throws JSONException,
                       IOException
Throws:
JSONException
IOException

add

public void add(String value)
         throws IOException
Throws:
IOException

add

public void add(int value)
         throws IOException
Throws:
IOException

add

public void add(long value)
         throws IOException
Throws:
IOException

add

public void add(double value)
         throws IOException
Throws:
IOException

add

public void add(float value)
         throws IOException
Throws:
IOException

add

public void add(boolean bool)
         throws IOException
Throws:
IOException

put

public void put(String key,
                String value)
         throws IOException,
                JSONException
Throws:
IOException
JSONException

put

public void put(String key,
                int value)
         throws JSONException,
                IOException
Throws:
JSONException
IOException

put

public void put(String key,
                float value)
         throws JSONException,
                IOException
Throws:
JSONException
IOException

put

public void put(String key,
                double value)
         throws JSONException,
                IOException
Throws:
JSONException
IOException

put

public void put(String key,
                long value)
         throws JSONException,
                IOException
Throws:
JSONException
IOException

put

public void put(String key,
                boolean value)
         throws JSONException,
                IOException
Throws:
JSONException
IOException

putNull

public void putNull(String key)
             throws JSONException,
                    IOException
Throws:
JSONException
IOException

putString

public void putString(String key,
                      Reader input)
               throws JSONException,
                      IOException
Generate the key/value pair from the Reader

Parameters:
key -
input -
Throws:
IOException
JSONException

flush

public void flush()
           throws IOException
Throws:
IOException

endJSON

public void endJSON()
             throws IOException
Throws:
IOException

getWriter

public Writer getWriter()


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.1 Japan License.