|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.util.Scan
public class Scan
A set of static methods to help scan values from a ReaderTokenizer.
Constructor Summary | |
---|---|
Scan()
|
Method Summary | |
---|---|
static boolean |
checkForFieldName(ReaderTokenizer rtok,
java.lang.String name)
Checks to see if the next input token corresponds to a specific field name. |
static java.awt.Color |
scanColor(ReaderTokenizer rtok)
Reads and returns a Color from a tokenizer. |
static int |
scanDoubles(double[] vals,
ReaderTokenizer rtok)
Reads a set of double values, enclosed in square brackets [
] . |
static double[] |
scanDoubles(ReaderTokenizer rtok)
Reads a set of double values, enclosed in square brackets [
] ,
and returns them in an array. |
static int |
scanFloats(float[] vals,
ReaderTokenizer rtok)
Reads a set of float values, enclosed in square brackets [
] . |
static float[] |
scanFloats(ReaderTokenizer rtok)
Reads a set of float values, enclosed in square brackets [
] ,
and returns them in an array. |
static int |
scanInts(int[] vals,
ReaderTokenizer rtok)
Reads a set of integer values, enclosed in square brackets [
] . |
static int[] |
scanInts(ReaderTokenizer rtok)
Reads a set of integer values, enclosed in square brackets [
] ,
and returns them in an array.Values which exceed the allowed range for
integers will be truncated in the high order bits. |
static int |
scanLongs(long[] vals,
ReaderTokenizer rtok)
Reads a set of long integer values, enclosed in square brackets [ ] . |
static long[] |
scanLongs(ReaderTokenizer rtok)
Reads a set of long integer values, enclosed in square brackets [ ] , and returns them in an array. |
static java.lang.String[] |
scanQuotedStrings(ReaderTokenizer rtok,
char quoteChar)
Reads a set of quoted strings, enclosed in square brackets [ ] , and returns them as an array of Strings. |
static Scannable |
scanScannable(ReaderTokenizer rtok,
java.lang.Object ref)
Scans a Scannable object, which is preceeded by it's class name. |
static short[] |
scanShorts(ReaderTokenizer rtok)
Reads a set of short integer values, enclosed in square brackets [ ] , and returns them in an array. |
static int |
scanShorts(short[] vals,
ReaderTokenizer rtok)
Reads a set of short integer values, enclosed in square brackets [ ] . |
static java.lang.String[] |
scanWords(ReaderTokenizer rtok)
Reads a set of words values, enclosed in square brackets [ ] ,
and returns them as an array of Strings. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Scan()
Method Detail |
---|
public static java.awt.Color scanColor(ReaderTokenizer rtok) throws java.io.IOException
[ ]
, representing red, green, and blue values, and an
optional alpha value, in the range 0 to 1. If alpha is not present, it
defaults to 1.
rtok
- Tokenizer from which the color is read
java.io.IOException
- if the color is formatted incorrectly or if an I/O error occuredpublic static int scanDoubles(double[] vals, ReaderTokenizer rtok) throws java.io.IOException
[
]
.
Values are placed in an argument array and the number of values actually
read is returned.
vals
- array in which values are storedrtok
- Tokenizer from which values are read
java.io.IOException
- if the number of values exceeds the size of the array, the values are not
numbers or are not enclosed in square brackets, or an I/O error occuredpublic static double[] scanDoubles(ReaderTokenizer rtok) throws java.io.IOException
[
]
,
and returns them in an array.
rtok
- Tokenizer from which values are read
java.io.IOException
- if the values are not numbers or are not enclosed in square brackets, or
an I/O error occuredpublic static int scanFloats(float[] vals, ReaderTokenizer rtok) throws java.io.IOException
[
]
.
Values are placed in an argument array and the number of values actually
read is returned.
vals
- array in which values are storedrtok
- Tokenizer from which values are read
java.io.IOException
- if the number of values exceeds the size of the array, the values are not
numbers or are not enclosed in square brackets, or an I/O error occuredpublic static float[] scanFloats(ReaderTokenizer rtok) throws java.io.IOException
[
]
,
and returns them in an array.
rtok
- Tokenizer from which values are read
java.io.IOException
- if the values are not numbers or are not enclosed in square brackets, or
an I/O error occuredpublic static int scanInts(int[] vals, ReaderTokenizer rtok) throws java.io.IOException
[
]
.
Values are placed in an argument array and the number of values actually
read is returned. Values which exceed the allowed range for integers will
be truncated in the high order bits.
vals
- array in which values are storedrtok
- Tokenizer from which values are read
java.io.IOException
- if the number of values exceeds the size of the array, the values are not
integers or are not enclosed in square brackets, or an I/O error occuredpublic static int[] scanInts(ReaderTokenizer rtok) throws java.io.IOException
[
]
,
and returns them in an array.Values which exceed the allowed range for
integers will be truncated in the high order bits.
rtok
- Tokenizer from which values are read
java.io.IOException
- if the values are not integers or are not enclosed in square brackets, or
an I/O error occuredpublic static int scanShorts(short[] vals, ReaderTokenizer rtok) throws java.io.IOException
[ ]
. Values are placed in an argument array and the number
of values actually read is returned. Values which exceed the allowed range
for shorts will be truncated in the high order bits.
vals
- array in which values are storedrtok
- Tokenizer from which values are read
java.io.IOException
- if the number of values exceeds the size of the array, the values are not
integers or are not enclosed in square brackets, or an I/O error occuredpublic static short[] scanShorts(ReaderTokenizer rtok) throws java.io.IOException
[ ]
, and returns them in an array. Values which exceed the
allowed range for shorts will be truncated in the high order bits.
rtok
- Tokenizer from which values are read
java.io.IOException
- if the values are not integers or are not enclosed in square brackets, or
an I/O error occuredpublic static int scanLongs(long[] vals, ReaderTokenizer rtok) throws java.io.IOException
[ ]
. Values are placed in an argument array and the number
of values actually read is returned. Values which exceed the allowed range
for longs will be truncated in the high order bits.
vals
- array in which values are storedrtok
- Tokenizer from which values are read
java.io.IOException
- if the number of values exceeds the size of the array, the values are not
integers or are not enclosed in square brackets, or an I/O error occuredpublic static long[] scanLongs(ReaderTokenizer rtok) throws java.io.IOException
[ ]
, and returns them in an array. Values which exceed the
allowed range for longs will be truncated in the high order bits.
rtok
- Tokenizer from which values are read
java.io.IOException
- if the values are not integers or are not enclosed in square brackets, or
an I/O error occuredpublic static java.lang.String[] scanWords(ReaderTokenizer rtok) throws java.io.IOException
[ ]
,
and returns them as an array of Strings.
rtok
- Tokenizer from which values are read
java.io.IOException
- if the values are not words or are not enclosed in square brackets, or an
I/O error occuredpublic static java.lang.String[] scanQuotedStrings(ReaderTokenizer rtok, char quoteChar) throws java.io.IOException
[ ]
, and returns them as an array of Strings.
rtok
- Tokenizer from which values are readquoteChar
- quote character for the strings
java.io.IOException
- if the strings are not quoted or are not enclosed in square brackets, or
an I/O error occuredpublic static Scannable scanScannable(ReaderTokenizer rtok, java.lang.Object ref) throws java.io.IOException
rtok
- Tokenizer from which values are read
java.io.IOException
- if there was an I/O error or if the Scannable object could not
be instantiated.public static boolean checkForFieldName(ReaderTokenizer rtok, java.lang.String name) throws java.io.IOException
rtok
- Tokenizer from which input is readname
- field name to check for
java.io.IOException
- if the field name was present but not followed by an '=' token, or an I/O
error occured
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |