Package ec.util
Class DecodeReturn
java.lang.Object
ec.util.DecodeReturn
DecodeReturn is used by Code to provide varied information returned
when decoding.
You start the decoding process by initializing the DecodeReturn
on a string you want to decode items out of. Then you repeatedly
pass the DecodeReturn to Code.decode(...), and each time the
DecodeReturn will contain information about the next token, namely,
its type, the data of the token (depending on type, this
can be in one of three slots, d, l, or s), and the start position
for reading the next token.
In case of an error, type is set to DecodeReturn.T_ERROR, pos is kept at the token where the error occured, and s is set to an error message.
-
Field Summary
Modifier and TypeFieldDescriptiondouble
Stores floats, doublesThe DecodeReturn string that's read from.long
Stores booleans (0=false), bytes, chars, shorts, ints, longsint
The Line number, if it has been posted.int
The DecodeReturn new position in the string.Stores strings, error messagesstatic final byte
static final byte
static final byte
static final byte
Same as T_CHARstatic final byte
static final byte
The actual error is stored in the String slotstatic final byte
static final byte
static final byte
Same as T_INTstatic final byte
static final byte
static final byte
byte
The DecodeReturn type -
Constructor Summary
ConstructorDescriptionDecodeReturn
(String _data) Use this to make a new DecodeReturn starting at position 0DecodeReturn
(String _data, int _pos) Use this to make a new DecodeReturn starting at some position -
Method Summary
Modifier and TypeMethodDescriptionUse this to reuse your DecodeReturn for another stringUse this to reuse your DecodeReturn for another stringscanAt
(int _pos) Sets the DecodeReturn to begin scanning at _pos, which should be valid.
-
Field Details
-
T_ERROR
public static final byte T_ERRORThe actual error is stored in the String slot- See Also:
-
T_BOOLEAN
public static final byte T_BOOLEAN- See Also:
-
T_BYTE
public static final byte T_BYTE- See Also:
-
T_CHAR
public static final byte T_CHAR- See Also:
-
T_CHARACTER
public static final byte T_CHARACTERSame as T_CHAR- See Also:
-
T_SHORT
public static final byte T_SHORT- See Also:
-
T_INT
public static final byte T_INT- See Also:
-
T_INTEGER
public static final byte T_INTEGERSame as T_INT- See Also:
-
T_LONG
public static final byte T_LONG- See Also:
-
T_FLOAT
public static final byte T_FLOAT- See Also:
-
T_DOUBLE
public static final byte T_DOUBLE- See Also:
-
T_STRING
public static final byte T_STRING- See Also:
-
lineNumber
public int lineNumberThe Line number, if it has been posted. -
type
public byte typeThe DecodeReturn type -
data
The DecodeReturn string that's read from. -
pos
public int posThe DecodeReturn new position in the string. Set this yourself. New values get set here automatically. -
l
public long lStores booleans (0=false), bytes, chars, shorts, ints, longs -
d
public double dStores floats, doubles -
s
Stores strings, error messages
-
-
Constructor Details
-
DecodeReturn
Use this to make a new DecodeReturn starting at position 0 -
DecodeReturn
Use this to make a new DecodeReturn starting at some position
-
-
Method Details
-
scanAt
Sets the DecodeReturn to begin scanning at _pos, which should be valid. -
reset
Use this to reuse your DecodeReturn for another string -
reset
Use this to reuse your DecodeReturn for another string
-