|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectabk.json.AJsonTokener
public class AJsonTokener
AJsonTokener coge una cadena de texto y extrae los caracteres y tokens de ella. A partir de él se puede construir un AJsonBean o un AJsonArray.
Field Summary | |
---|---|
private long |
character
Current read character position on the current line. |
private long |
characterPreviousLine
The number of characters read in the previous line. |
private boolean |
eof
Flag to indicate if the end of the input has been found. |
private long |
index
Current read index of the input. |
private long |
line
Current line of the input. |
private char |
previous
Previous character read from the input. |
private Reader |
reader
Reader for the input. |
private boolean |
usePrevious
Flag to indicate that a previous character was requested. |
Constructor Summary | |
---|---|
AJsonTokener(Reader reader)
Construct a AJsonTokener from a Reader. |
|
AJsonTokener(String s)
Construct a AJsonTokener from a string. |
Method Summary | |
---|---|
private void |
addKey(AJsonBean jean,
String key)
|
void |
back()
Back up one character. |
private void |
decrementIndexes()
Decrements the indexes for the back() method based on the previous character read. |
boolean |
end()
Comprueba si se ha alcanzado el final de la entrada en proceso |
private void |
incrementIndexes(int c)
Increments the internal indexes according to the previous character read and the character passed as the current character. |
char |
next()
Get the next character in the source string. |
String |
next(int n)
Get the next n characters. |
char |
nextClean()
Get the next char in the string, skipping whitespace. |
private String |
nextKey()
Devuelve el siguiente token como una cadena de texto para ser usada como la clave de la siguiente propiedad del objeto. |
String |
nextString(char quote)
Return the characters up to the next close quote character. |
AJsonElement |
nextValue()
Get the next value. |
static AJsonElement |
stringToValue(String string)
Try to convert a string into a number, boolean, or null. |
ParseException |
syntaxError(AMessageKey msg)
Make a ParseException to signal a syntax error. |
ParseException |
syntaxError(AMessageKey msg,
Throwable causedBy)
Make a ParseException to signal a syntax error. |
AJsonArray |
toJsonArray()
Construye un objeto AJsonArray a partir de un AJsonTokener. |
AJsonBean |
toJsonBean()
Construye un objeto AJsonBean desde un AJsonTokener. |
String |
toString()
Make a printable string of this AJsonTokener. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private long character
private boolean eof
private long index
private long line
private char previous
private final Reader reader
private boolean usePrevious
private long characterPreviousLine
Constructor Detail |
---|
public AJsonTokener(Reader reader)
reader
- A reader.public AJsonTokener(String s)
s
- A source string.Method Detail |
---|
public void back()
UnsupportedOperationException
- Thrown if trying to step back more than 1 step or if
already at the start of the stringprivate void decrementIndexes()
back()
method based on the previous character read.
public boolean end()
true
si estamos al final del fichero y no tenemos pendiente volver atrĂ¡s.public char next()
IllegalStateException
- Thrown if there is an error reading the source string.private void incrementIndexes(int c)
c
- the current character read.public String next(int n) throws ParseException
n
- The number of characters to take.
ParseException
- Substring bounds error if there are not n characters remaining in the
source string.public char nextClean()
IllegalStateException
- Thrown if there is an error reading the source string.public String nextString(char quote) throws ParseException
quote
- The quoting character, either "
(double quote)
or '
(single quote).
ParseException
- Unterminated string.public AJsonElement nextValue() throws ParseException
ParseException
- If syntax error.
IllegalStateException
- Thrown if there is an error reading the source string.public ParseException syntaxError(AMessageKey msg)
msg
- The error message.
public ParseException syntaxError(AMessageKey msg, Throwable causedBy)
msg
- The error message.causedBy
- The throwable that caused the error.
public String toString()
toString
in class Object
public static final AJsonElement stringToValue(String string)
string
- A String.
private String nextKey() throws ParseException
ParseException
- si el siguiente token no se corresponde con un
AJsonString.public AJsonBean toJsonBean() throws ParseException
ParseException
- si hay un error de sintaxis o una clave duplicada.private void addKey(AJsonBean jean, String key) throws ParseException
ParseException
public AJsonArray toJsonArray() throws ParseException
ParseException
- Si hay un error de sintaxis.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |