public class JsopStream extends java.lang.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 writer.
|
JsopStream |
array()
Append '['.
|
JsopStream |
encodedValue(java.lang.String raw)
Append an already encoded value.
|
JsopStream |
endArray()
Append ']'.
|
JsopStream |
endObject()
Append '}'.
|
java.lang.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(java.lang.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.
|
java.lang.String |
read(int type)
Read a token which must match a given token type.
|
java.lang.String |
readRawValue()
Return the row (escaped) token.
|
java.lang.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.
|
java.lang.String |
toString() |
JsopStream |
value(boolean b)
Append the boolean value 'true' or 'false'.
|
JsopStream |
value(long x)
Append a number.
|
JsopStream |
value(java.lang.String value)
Append a string or null.
|
public JsopStream append(JsopWriter w)
JsopWriter
append
in interface JsopWriter
w
- the writerpublic JsopStream tag(char tag)
JsopWriter
tag
in interface JsopWriter
tag
- the string to appendpublic JsopStream array()
JsopWriter
array
in interface JsopWriter
public JsopStream encodedValue(java.lang.String raw)
JsopWriter
encodedValue
in interface JsopWriter
raw
- the valuepublic JsopStream endArray()
JsopWriter
endArray
in interface JsopWriter
public JsopStream endObject()
JsopWriter
endObject
in interface JsopWriter
public JsopStream key(java.lang.String key)
JsopWriter
key
in interface JsopWriter
key
- the keypublic JsopStream newline()
JsopWriter
newline
in interface JsopWriter
public JsopStream object()
JsopWriter
object
in interface JsopWriter
public JsopStream value(java.lang.String value)
JsopWriter
value
in interface JsopWriter
value
- the valuepublic JsopStream value(long x)
JsopWriter
value
in interface JsopWriter
x
- the valuepublic JsopStream value(boolean b)
JsopWriter
value
in interface JsopWriter
b
- the valuepublic void resetReader()
JsopReader
resetReader
in interface JsopReader
public void resetWriter()
JsopWriter
resetWriter
in interface JsopWriter
public void setLineLength(int i)
JsopWriter
setLineLength
in interface JsopWriter
i
- the lengthpublic java.lang.String getToken()
JsopReader
getToken
in interface JsopReader
public int getTokenType()
JsopReader
getTokenType
in interface JsopReader
public boolean matches(int type)
JsopReader
matches
in interface JsopReader
type
- the token typepublic java.lang.String read(int type)
JsopReader
read
in interface JsopReader
type
- the token typepublic int read()
JsopReader
read
in interface JsopReader
public java.lang.String readRawValue()
JsopReader
readRawValue
in interface JsopReader
public java.lang.String readString()
JsopReader
readString
in interface JsopReader
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved