Interface JsopWriter
- 
- All Known Implementing Classes:
 JsopBuilder,JsopStream
public interface JsopWriterA builder for Json and Json diff strings. It knows when a comma is needed. A comma is appended before '{', '[', a value, or a key; but only if the last appended token was '}', ']', or a value. There is no limit to the number of nesting levels. 
- 
- 
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JsopWriterappend(JsopWriter diff)Append all entries of the given writer.JsopWriterarray()Append '['.JsopWriterencodedValue(java.lang.String raw)Append an already encoded value.JsopWriterendArray()Append ']'.JsopWriterendObject()Append '}'.JsopWriterkey(java.lang.String key)Append the key (in quotes) plus a colon.JsopWriternewline()Append a newline character.JsopWriterobject()Append '{'.voidresetWriter()Resets this instance, so that all data is discarded.voidsetLineLength(int length)Set the line length, after which a newline is added (to improve readability).JsopWritertag(char tag)Append a Jsop tag character.JsopWritervalue(boolean b)Append the boolean value 'true' or 'false'.JsopWritervalue(long x)Append a number.JsopWritervalue(java.lang.String value)Append a string or null. 
 - 
 
- 
- 
Method Detail
- 
array
JsopWriter array()
Append '['. A comma is appended first if needed.- Returns:
 - this
 
 
- 
object
JsopWriter object()
Append '{'. A comma is appended first if needed.- Returns:
 - this
 
 
- 
key
JsopWriter key(java.lang.String key)
Append the key (in quotes) plus a colon. A comma is appended first if needed.- Parameters:
 key- the key- Returns:
 - this
 
 
- 
value
JsopWriter value(java.lang.String value)
Append a string or null. A comma is appended first if needed.- Parameters:
 value- the value- Returns:
 - this
 
 
- 
encodedValue
JsopWriter encodedValue(java.lang.String raw)
Append an already encoded value. A comma is appended first if needed.- Parameters:
 raw- the value- Returns:
 - this
 
 
- 
endObject
JsopWriter endObject()
Append '}'.- Returns:
 - this
 
 
- 
endArray
JsopWriter endArray()
Append ']'.- Returns:
 - this
 
 
- 
tag
JsopWriter tag(char tag)
Append a Jsop tag character.- Parameters:
 tag- the string to append- Returns:
 - this
 
 
- 
append
JsopWriter append(JsopWriter diff)
Append all entries of the given writer.- Parameters:
 diff- the writer- Returns:
 - this
 
 
- 
value
JsopWriter value(long x)
Append a number. A comma is appended first if needed.- Parameters:
 x- the value- Returns:
 - this
 
 
- 
value
JsopWriter value(boolean b)
Append the boolean value 'true' or 'false'. A comma is appended first if needed.- Parameters:
 b- the value- Returns:
 - this
 
 
- 
newline
JsopWriter newline()
Append a newline character.- Returns:
 - this
 
 
- 
resetWriter
void resetWriter()
Resets this instance, so that all data is discarded. 
- 
setLineLength
void setLineLength(int length)
Set the line length, after which a newline is added (to improve readability).- Parameters:
 length- the length
 
 - 
 
 -