Class UDMFScanner

java.lang.Object
net.mtrop.doom.map.udmf.UDMFScanner
All Implemented Interfaces:
Iterator<UDMFScanner.Element>

public final class UDMFScanner extends Object implements 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
  • Method Details

    • createScanner

      public static UDMFScanner createScanner(InputStream in) throws IOException
      Creates a UDMFScanner for reading UDMF-formatted data from an InputStream.
      Parameters:
      in - the InputStream to read from.
      Returns:
      a new scanner for controlled reading.
      Throws:
      IOException - if the data can't be read.
    • createScanner

      public static UDMFScanner createScanner(String data) throws IOException
      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

      public static UDMFScanner createScanner(Reader reader) throws IOException
      Creates a UDMFScanner for reading UDMF-formatted data from a Reader.
      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:
      hasNext in interface Iterator<UDMFScanner.Element>
      Returns:
      true if more elements can be read, false if not.
    • next

      public UDMFScanner.Element next()
      Checks if there are more elements to read.
      Specified by:
      next in interface Iterator<UDMFScanner.Element>
      Returns:
      the next element read, null if no more elements.
      Throws:
      UDMFParseException - if the UDMF document cannot be parsed during read.