Class UDMFScanner
java.lang.Object
net.mtrop.doom.map.udmf.UDMFScanner
- All Implemented Interfaces:
Iterator<UDMFScanner.Element>
A mechanism for reading UDMF data, element by element, in a pull-oriented way.
compared to
UDMFReader, which is push-oriented.- Since:
- 2.4.0
- Author:
- Matthew Tropiano
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA single scanned element from the scanner.static enumThe element type returned on each element scanned. -
Method Summary
Modifier and TypeMethodDescriptionstatic UDMFScannerCreates a UDMFScanner for reading UDMF-formatted data from anInputStream.static UDMFScannercreateScanner(Reader reader) Creates a UDMFScanner for reading UDMF-formatted data from aReader.static UDMFScannercreateScanner(String data) Creates a UDMFScanner for reading UDMF-formatted data from a String.booleanhasNext()Checks if there are more elements to read.next()Checks if there are more elements to read.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Method Details
-
createScanner
Creates a UDMFScanner for reading UDMF-formatted data from anInputStream.- Parameters:
in- the InputStream to read from.- Returns:
- a new scanner for controlled reading.
- Throws:
IOException- if the data can't be read.
-
createScanner
Creates a UDMFScanner for reading UDMF-formatted data from a String.- Parameters:
data- the String to read from.- Returns:
- a UDMFTable containing the structures.
- Throws:
UDMFParseException- if a parsing error occurs.IOException- if the data can't be read.
-
createScanner
Creates a UDMFScanner for reading UDMF-formatted data from aReader.- Parameters:
reader- the reader to read from.- Returns:
- a UDMFTable containing the parsed structures.
- Throws:
UDMFParseException- if a parsing error occurs.IOException- if the data can't be read.
-
hasNext
public boolean hasNext()Checks if there are more elements to read.- Specified by:
hasNextin interfaceIterator<UDMFScanner.Element>- Returns:
- true if more elements can be read, false if not.
-
next
Checks if there are more elements to read.- Specified by:
nextin interfaceIterator<UDMFScanner.Element>- Returns:
- the next element read, null if no more elements.
- Throws:
UDMFParseException- if the UDMF document cannot be parsed during read.
-