Package org.cip4.jdflib.util
Class SScanf
java.lang.Object
java.io.Reader
org.cip4.jdflib.cformat.ScanfReader
org.cip4.jdflib.util.SScanf
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable,Iterator<Object>
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptioncreates a scanf reader for a given string and format and returns the approriate object valid format identifiers %f - returns Double %i - returns Integer %d - returns Integer %x - returns Integer %o - returns Integer %c - returns String %s - returns String -
Method Summary
Modifier and TypeMethodDescriptionbooleanhasNext()next()returns the next Object (@see the constructor), null if the string has been completely parsed or an invalid format is scannedvoidremove()NOT IMPLEMENTED - the iterator is only forwarddoublescanDouble(ScanfFormat fmt) Scan and return a double, using a pre-allocated ScanfFormat object.scanString(ScanfFormat fmt) Scan and return a String, using a pre-allocated ScanfFormat object.sscanf()scan a string using C++ sscanf functionalityconvenience static function - see the constructor for detailsMethods inherited from class org.cip4.jdflib.cformat.ScanfReader
clearLookAheadChar, close, getCharNumber, getLineNumber, getLookAheadChar, lookAheadCharValid, read, scanChar, scanChar, scanChar, scanChars, scanChars, scanChars, scanDec, scanDec, scanDec, scanDouble, scanDouble, scanFloat, scanFloat, scanFloat, scanHex, scanHex, scanHex, scanInt, scanInt, scanInt, scanLong, scanLong, scanLong, scanOct, scanOct, scanOct, scanString, scanString, setCharNumber, setLineNumber, useCstandard, useCstandardMethods inherited from class java.io.Reader
mark, markSupported, nullReader, read, read, read, ready, reset, skip, transferToMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
SScanf
creates a scanf reader for a given string and format and returns the approriate object valid format identifiers %f - returns Double %i - returns Integer %d - returns Integer %x - returns Integer %o - returns Integer %c - returns String %s - returns String- Parameters:
theString- the String to scanformat- the formatting String to apply according to c++ sscanf rools
-
-
Method Details
-
sscanf
scan a string using C++ sscanf functionality- Returns:
-
scanDouble
public double scanDouble(ScanfFormat fmt) throws IOException, ScanfMatchException, IllegalArgumentException Description copied from class:ScanfReaderScan and return a double, using a pre-allocated ScanfFormat object. This saves the overhead of parsing the format from a string.- Overrides:
scanDoublein classScanfReader- Parameters:
fmt- Format object- Returns:
- Scanned double value
- Throws:
ScanfMatchException- Input did not match formatEOFException- End of fileIOException- Other input errorIllegalArgumentException- Error in format specification- See Also:
-
scanString
Description copied from class:ScanfReaderScan and return a String, using a pre-allocated ScanfFormat object. This saves the overhead of parsing the format from a string.- Overrides:
scanStringin classScanfReader- Parameters:
fmt- Format object- Returns:
- Scanned String
- Throws:
ScanfMatchException- Input did not match formatEOFException- End of fileIOException- Other input errorIllegalArgumentException- Error in format specification- See Also:
-
hasNext
public boolean hasNext() -
next
returns the next Object (@see the constructor), null if the string has been completely parsed or an invalid format is scanned -
remove
public void remove()NOT IMPLEMENTED - the iterator is only forward -
sscanf
convenience static function - see the constructor for details- Parameters:
theString-format-- Returns:
- Vector of scanned objects - see constructor for details
-