Package com.yahoo.text
Class JSONWriter
- java.lang.Object
-
- com.yahoo.text.JSONWriter
-
public final class JSONWriter extends java.lang.Object
A class which knows how to write JSON markup. All methods return this to enable chaining of method calls. Consider using the Jackson generator API instead, as that may be faster.- Author:
- bratseth
-
-
Constructor Summary
Constructors Constructor Description JSONWriter(java.io.OutputStream stream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JSONWriter
beginArray()
Begin an array valueJSONWriter
beginArrayValue()
Begins an array valueJSONWriter
beginField(java.lang.String fieldName)
Begins an object fieldJSONWriter
beginObject()
Begin an object valueJSONWriter
endArray()
End an array valueJSONWriter
endArrayValue()
Ends an array valueJSONWriter
endField()
Ends an object fieldJSONWriter
endObject()
End an object valueJSONWriter
value()
Writes a null valueJSONWriter
value(boolean value)
Writes a boolean valueJSONWriter
value(java.lang.Number value)
Writes a numeric valueJSONWriter
value(java.lang.String value)
Writes a string value
-
-
-
Method Detail
-
beginField
public JSONWriter beginField(java.lang.String fieldName) throws java.io.IOException
Begins an object field- Throws:
java.io.IOException
-
endField
public JSONWriter endField() throws java.io.IOException
Ends an object field- Throws:
java.io.IOException
-
beginArrayValue
public JSONWriter beginArrayValue() throws java.io.IOException
Begins an array value- Throws:
java.io.IOException
-
endArrayValue
public JSONWriter endArrayValue() throws java.io.IOException
Ends an array value- Throws:
java.io.IOException
-
beginObject
public JSONWriter beginObject() throws java.io.IOException
Begin an object value- Throws:
java.io.IOException
-
endObject
public JSONWriter endObject() throws java.io.IOException
End an object value- Throws:
java.io.IOException
-
beginArray
public JSONWriter beginArray() throws java.io.IOException
Begin an array value- Throws:
java.io.IOException
-
endArray
public JSONWriter endArray() throws java.io.IOException
End an array value- Throws:
java.io.IOException
-
value
public JSONWriter value(java.lang.String value) throws java.io.IOException
Writes a string value- Throws:
java.io.IOException
-
value
public JSONWriter value(java.lang.Number value) throws java.io.IOException
Writes a numeric value- Throws:
java.io.IOException
-
value
public JSONWriter value(boolean value) throws java.io.IOException
Writes a boolean value- Throws:
java.io.IOException
-
value
public JSONWriter value() throws java.io.IOException
Writes a null value- Throws:
java.io.IOException
-
-