org.exoplatform.ws.frameworks.json.impl
Class JsonWriterImpl

java.lang.Object
  extended by org.exoplatform.ws.frameworks.json.impl.JsonWriterImpl
All Implemented Interfaces:
JsonWriter

public class JsonWriterImpl
extends java.lang.Object
implements JsonWriter

Version:
$Id: $
Author:
Andrey Parfonov

Constructor Summary
JsonWriterImpl(java.io.OutputStream out)
          Constructs JsonWriter.
JsonWriterImpl(java.io.Writer writer)
          Constructs JsonWriter.
 
Method Summary
 void close()
          Close output writer.
 void flush()
          Flush output writer.
 void writeEndArray()
          Write the end of JSON array ']'.
 void writeEndObject()
          Write the end of JSON object '}'.
 void writeKey(java.lang.String key)
          Write the key.
 void writeNull()
          Write the null data to stream.
 void writeStartArray()
          Write the start of JSON array '['.
 void writeStartObject()
          Write the start of JSON object '{'.
 void writeString(java.lang.String value)
          Write the String to stream.
 void writeValue(boolean value)
          Write the value of boolean type to stream.
 void writeValue(double value)
          Write the value of double type to stream.
 void writeValue(long value)
          Write the value of long type to stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonWriterImpl

public JsonWriterImpl(java.io.Writer writer)
Constructs JsonWriter.

Parameters:
writer - Writer.

JsonWriterImpl

public JsonWriterImpl(java.io.OutputStream out)
Constructs JsonWriter.

Parameters:
out - OutputStream.
Method Detail

writeStartObject

public void writeStartObject()
                      throws JsonException
Write the start of JSON object '{'.

Specified by:
writeStartObject in interface JsonWriter
Throws:
JsonException - if any errors, include i/o errors occurs.

writeEndObject

public void writeEndObject()
                    throws JsonException
Write the end of JSON object '}'.

Specified by:
writeEndObject in interface JsonWriter
Throws:
JsonException - if any errors, include i/o errors occurs.

writeStartArray

public void writeStartArray()
                     throws JsonException
Write the start of JSON array '['.

Specified by:
writeStartArray in interface JsonWriter
Throws:
JsonException - if any errors, include i/o errors occurs.

writeEndArray

public void writeEndArray()
                   throws JsonException
Write the end of JSON array ']'.

Specified by:
writeEndArray in interface JsonWriter
Throws:
JsonException - if any errors, include i/o errors occurs.

writeKey

public void writeKey(java.lang.String key)
              throws JsonException
Write the key. After key will go the value. In this way data represented in JSON object.

Specified by:
writeKey in interface JsonWriter
Parameters:
key - the key.
Throws:
JsonException - if any errors, include i/o errors occurs.

writeString

public void writeString(java.lang.String value)
                 throws JsonException
Write the String to stream.

Specified by:
writeString in interface JsonWriter
Parameters:
value - the String.
Throws:
JsonException - if any errors, include i/o errors occurs.

writeValue

public void writeValue(long value)
                throws JsonException
Write the value of long type to stream.

Specified by:
writeValue in interface JsonWriter
Parameters:
value - the value of long type.
Throws:
JsonException - if any errors, include i/o errors occurs.

writeValue

public void writeValue(double value)
                throws JsonException
Write the value of double type to stream.

Specified by:
writeValue in interface JsonWriter
Parameters:
value - the value of double type.
Throws:
JsonException - if any errors, include i/o errors occurs.

writeValue

public void writeValue(boolean value)
                throws JsonException
Write the value of boolean type to stream.

Specified by:
writeValue in interface JsonWriter
Parameters:
value - the value of boolean type.
Throws:
JsonException - if any errors, include i/o errors occurs.

writeNull

public void writeNull()
               throws JsonException
Write the null data to stream.

Specified by:
writeNull in interface JsonWriter
Throws:
JsonException - if any errors, include i/o errors occurs.

flush

public void flush()
           throws JsonException
Flush output writer.

Specified by:
flush in interface JsonWriter
Throws:
JsonException - if any errors, include i/o errors occurs.

close

public void close()
           throws JsonException
Close output writer.

Specified by:
close in interface JsonWriter
Throws:
JsonException - if any errors, include i/o errors occurs.


Copyright © 2011 eXo Platform SAS. All Rights Reserved.