org.apache.wink.json4j
Class JSONStringer
java.lang.Object
org.apache.wink.json4j.JSONWriter
org.apache.wink.json4j.JSONStringer
public class JSONStringer
- extends JSONWriter
This class implements a JSONSringer, a basic convenience subclass of JSONWriter to allow for
generating JSON strings quickly. This class exists for API compatibility to other popular
JSON parsers.
Method Summary |
void |
close()
Over-ride to do nothing for the stringer. |
String |
toString()
Return a string of the stringer contents. |
Methods inherited from class org.apache.wink.json4j.JSONWriter |
array, endArray, endObject, flush, key, object, value, value, value, value, value, value |
JSONStringer
public JSONStringer()
toString
public String toString()
- Return a string of the stringer contents. This also terminates the
Stringer and it cannot be used again. If any errors occur while trying to generate the JSON
it returns an empty string.
- Overrides:
toString
in class Object
close
public void close()
throws IOException,
IllegalStateException
- Over-ride to do nothing for the stringer. Only toString() terminates the stringer object.
- Overrides:
close
in class JSONWriter
- Throws:
IOException
- Thrown if an IO error occurs on the underlying writer.
IllegalStateException
- Thrown if the writer position is in an object and a key has been placed, but a value has not been assigned or if the writer was already closed.
Copyright © 2009-2012 The Apache Software Foundation. All Rights Reserved.