|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--cformat.ScanfFormat
Format object for scanning input in the same way as the
C scanf
function.
A scanf
style format string is specified in the
constructor. Once instantiated, objects of this class may
be passed as arguments to the scan
methods
of the ScanfReader
class.
ScanfReader
Constructor Summary | |
ScanfFormat(java.lang.String fmt)
Constructs a ScanfFormat class from a format string. |
Method Summary | |
void |
set(java.lang.String fmt)
Sets the contents of the object according to the information provided in the format string. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ScanfFormat(java.lang.String fmt)
set
method.
fmt
- Format string
java.lang.IllegalArgumentException
- Malformed format stringScanfReader
Method Detail |
public void set(java.lang.String fmt)
The format string describes what input to expect for a
ScanfReader, and its form closely matches that for the C
scanf
function, expect that multiple conversions
cannot be specified.
A conversion sequence is introduced by the '%' character; valid conversion sequences are described below. Other characters may appear in the format string. A white space character requests a match of any amount of white space, including none. Other characters request an exact match of themselves. The character sequence "%%" requests a match of the '%' character.
The '%' character introducing a conversion sequence may be followed by an unsigned decimal integer indicating the field width, which is the maximum number of characters used for a particular conversion. Field widths must be greater than 0.
The optional field width is followed by one of the following conversion characters, which specifies the primitive type to be scanned:
0x
", then a hex value is scanned; if
the digit sequence begins with "0
", then an octal
value is scanned; and otherwise a decimal value is scanned.
fmt
- Format string
java.lang.IllegalArgumentException
- Malformed format stringScanfReader
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |