Package org.apache.felix.utils.json
Class JSONWriter
- java.lang.Object
-
- org.apache.felix.utils.json.JSONWriter
-
public class JSONWriter extends java.lang.ObjectSimple JSON writer to be used on top of aWriter.
-
-
Constructor Summary
Constructors Constructor Description JSONWriter(java.io.Writer pw)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JSONWriterarray()JSONWriterendArray()JSONWriterendObject()voidflush()JSONWriterkey(java.lang.String key)JSONWriterobject()private voidquote(java.lang.String value)Quote the provided value and escape some characters.JSONWritervalue(boolean b)JSONWritervalue(double d)JSONWritervalue(int i)JSONWritervalue(long l)JSONWritervalue(java.lang.Object value)
-
-
-
Method Detail
-
object
public JSONWriter object() throws java.io.IOException
- Throws:
java.io.IOException
-
endObject
public JSONWriter endObject() throws java.io.IOException
- Throws:
java.io.IOException
-
array
public JSONWriter array() throws java.io.IOException
- Throws:
java.io.IOException
-
endArray
public JSONWriter endArray() throws java.io.IOException
- Throws:
java.io.IOException
-
key
public JSONWriter key(java.lang.String key) throws java.io.IOException
- Throws:
java.io.IOException
-
value
public JSONWriter value(boolean b) throws java.io.IOException
- Throws:
java.io.IOException
-
value
public JSONWriter value(double d) throws java.io.IOException
- Throws:
java.io.IOException
-
value
public JSONWriter value(int i) throws java.io.IOException
- Throws:
java.io.IOException
-
value
public JSONWriter value(long l) throws java.io.IOException
- Throws:
java.io.IOException
-
value
public JSONWriter value(java.lang.Object value) throws java.io.IOException
- Throws:
java.io.IOException
-
quote
private void quote(java.lang.String value) throws java.io.IOExceptionQuote the provided value and escape some characters.- Parameters:
value- The value to quote- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException- Throws:
java.io.IOException- when the underlying writer throws an exception.- See Also:
Writer.flush()
-
-