com.alibaba.dubbo.common.json
Class JSONWriter

java.lang.Object
  extended by com.alibaba.dubbo.common.json.JSONWriter

public class JSONWriter
extends Object

JSON Writer.

w.objectBegin().objectItem("name").valueString("qianlei").objectEnd() = {name:"qianlei"}.

Author:
qian.lei

Constructor Summary
JSONWriter(OutputStream is, String charset)
           
JSONWriter(Writer writer)
           
 
Method Summary
 JSONWriter arrayBegin()
          array begin.
 JSONWriter arrayEnd()
          array end, return array value.
 JSONWriter objectBegin()
          object begin.
 JSONWriter objectEnd()
          object end.
 JSONWriter objectItem(String name)
          object item.
 JSONWriter valueBoolean(boolean value)
          value.
 JSONWriter valueDouble(double value)
          value.
 JSONWriter valueFloat(float value)
          value.
 JSONWriter valueInt(int value)
          value.
 JSONWriter valueLong(long value)
          value.
 JSONWriter valueNull()
          value.
 JSONWriter valueString(String value)
          value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSONWriter

public JSONWriter(Writer writer)

JSONWriter

public JSONWriter(OutputStream is,
                  String charset)
           throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException
Method Detail

objectBegin

public JSONWriter objectBegin()
                       throws IOException
object begin.

Returns:
this.
Throws:
IOException.
IOException

objectEnd

public JSONWriter objectEnd()
                     throws IOException
object end.

Returns:
this.
Throws:
IOException.
IOException

objectItem

public JSONWriter objectItem(String name)
                      throws IOException
object item.

Parameters:
name - name.
Returns:
this.
Throws:
IOException.
IOException

arrayBegin

public JSONWriter arrayBegin()
                      throws IOException
array begin.

Returns:
this.
Throws:
IOException.
IOException

arrayEnd

public JSONWriter arrayEnd()
                    throws IOException
array end, return array value.

Returns:
this.
Throws:
IOException.
IOException

valueNull

public JSONWriter valueNull()
                     throws IOException
value.

Returns:
this.
Throws:
IOException.
IOException

valueString

public JSONWriter valueString(String value)
                       throws IOException
value.

Parameters:
value - value.
Returns:
this.
Throws:
IOException

valueBoolean

public JSONWriter valueBoolean(boolean value)
                        throws IOException
value.

Parameters:
value - value.
Returns:
this.
Throws:
IOException

valueInt

public JSONWriter valueInt(int value)
                    throws IOException
value.

Parameters:
value - value.
Returns:
this.
Throws:
IOException

valueLong

public JSONWriter valueLong(long value)
                     throws IOException
value.

Parameters:
value - value.
Returns:
this.
Throws:
IOException

valueFloat

public JSONWriter valueFloat(float value)
                      throws IOException
value.

Parameters:
value - value.
Returns:
this.
Throws:
IOException

valueDouble

public JSONWriter valueDouble(double value)
                       throws IOException
value.

Parameters:
value - value.
Returns:
this.
Throws:
IOException


Copyright © 2012–2017 Alibaba. All rights reserved.