public class JsopStream extends Object implements JsopReader, JsopWriter
COMMENT, END, ERROR, FALSE, IDENTIFIER, NULL, NUMBER, STRING, TRUE| Constructor and Description |
|---|
JsopStream() |
| Modifier and Type | Method and Description |
|---|---|
JsopStream |
append(JsopWriter w)
Append all entries of the given buffer.
|
JsopStream |
array()
Append '['.
|
JsopStream |
encodedValue(String raw)
Append an already encoded value.
|
JsopStream |
endArray()
Append ']'.
|
JsopStream |
endObject()
Append '}'.
|
String |
getToken()
Get the last token value if the the token type was STRING or NUMBER.
|
int |
getTokenType()
Get the token type of the last token.
|
JsopStream |
key(String key)
Append the key (in quotes) plus a colon.
|
boolean |
matches(int type)
Read a token which must match a given token type.
|
JsopStream |
newline()
Append a newline character.
|
JsopStream |
object()
Append '{'.
|
int |
read()
Read a token and return the token type.
|
String |
read(int type)
Read a token which must match a given token type.
|
String |
readRawValue()
Return the row (escaped) token.
|
String |
readString()
Read a string.
|
void |
resetReader()
Reset the position to 0, so that to restart reading.
|
void |
resetWriter()
Resets this instance, so that all data is discarded.
|
void |
setLineLength(int i)
Set the line length, after which a newline is added (to improve
readability).
|
JsopStream |
tag(char tag)
Append a Jsop tag character.
|
String |
toString() |
JsopStream |
value(boolean b)
Append the boolean value 'true' or 'false'.
|
JsopStream |
value(long x)
Append a number.
|
JsopStream |
value(String value)
Append a string or null.
|
public JsopStream append(JsopWriter w)
JsopWriterappend in interface JsopWriterpublic JsopStream tag(char tag)
JsopWritertag in interface JsopWritertag - the string to appendpublic JsopStream array()
JsopWriterarray in interface JsopWriterpublic JsopStream encodedValue(String raw)
JsopWriterencodedValue in interface JsopWriterpublic JsopStream endArray()
JsopWriterendArray in interface JsopWriterpublic JsopStream endObject()
JsopWriterendObject in interface JsopWriterpublic JsopStream key(String key)
JsopWriterkey in interface JsopWriterpublic JsopStream newline()
JsopWriternewline in interface JsopWriterpublic JsopStream object()
JsopWriterobject in interface JsopWriterpublic JsopStream value(String value)
JsopWritervalue in interface JsopWritervalue - the valuepublic JsopStream value(long x)
JsopWritervalue in interface JsopWriterpublic JsopStream value(boolean b)
JsopWritervalue in interface JsopWriterpublic void resetReader()
JsopReaderresetReader in interface JsopReaderpublic void resetWriter()
JsopWriterresetWriter in interface JsopWriterpublic void setLineLength(int i)
JsopWritersetLineLength in interface JsopWriteri - the lengthpublic String getToken()
JsopReadergetToken in interface JsopReaderpublic int getTokenType()
JsopReadergetTokenType in interface JsopReaderpublic boolean matches(int type)
JsopReadermatches in interface JsopReadertype - the token typepublic String read(int type)
JsopReaderread in interface JsopReadertype - the token typepublic int read()
JsopReaderread in interface JsopReaderpublic String readRawValue()
JsopReaderreadRawValue in interface JsopReaderpublic String readString()
JsopReaderreadString in interface JsopReaderCopyright © 2012-2013 The Apache Software Foundation. All Rights Reserved.