Class DlgpParser

All Implemented Interfaces:
Parser<Object>, CloseableIterator<Object>, Closeable, AutoCloseable

public final class DlgpParser extends AbstractCloseableIterator<Object> implements Parser<Object>
Main access point of the DLGP parser.
Author:
Florent Tornil
  • Constructor Details

    • DlgpParser

      public DlgpParser(Reader reader)
      Constructor for parsing from the given reader.
      Parameters:
      reader - the java reader used to retrieve data
    • DlgpParser

      public DlgpParser()
      Constructor for parsing from the standard input.
    • DlgpParser

      public DlgpParser(File file) throws FileNotFoundException
      Constructor for parsing from the given file.
      Parameters:
      file - java file object to read from
      Throws:
      FileNotFoundException - if the given file does not exist
    • DlgpParser

      public DlgpParser(String s)
      Constructor for parsing the content of the string s as DLGP content.
      Parameters:
      s - a DLGP input as String
    • DlgpParser

      public DlgpParser(InputStream in)
      Constructor for parsing the given InputStream.
      Parameters:
      in - java InputStream to read from
  • Method Details

    • finalize

      protected void finalize() throws Throwable
      Overrides:
      finalize in class AbstractCloseableIterator<Object>
      Throws:
      Throwable
    • hasNext

      public boolean hasNext()
      Description copied from interface: CloseableIterator
      Indicates whether another element can be read from the iterator.
      Specified by:
      hasNext in interface CloseableIterator<Object>
      Specified by:
      hasNext in interface Parser<Object>
      Returns:
      true iff there is a next element
    • next

      public Object next() throws ParseException
      Description copied from interface: CloseableIterator
      Returns the next element from the iterator.
      Specified by:
      next in interface CloseableIterator<Object>
      Specified by:
      next in interface Parser<Object>
      Returns:
      the next element
      Throws:
      ParseException
    • close

      public void close()
      Closes the stream and releases any system resources associated with it. Closing a previously closed parser has no effect.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface CloseableIterator<Object>
    • parseFile

      public static ParserResult parseFile(String filepath)
      Parses the file located at the given path
      Collects all the content of the file in a single object and return only after reading the whole file.
      Parameters:
      filepath - path of the file to parseAll
      Returns:
      an object wrapping the dlgp
    • parseFiles

      public static ParserResult parseFiles(Collection<String> filepaths)
      Parses the files located at a given collection of paths
      Collects all the file in a single object and return only after reading the whole file.
      Parameters:
      filepaths - path of the file to parseAll
      Returns:
      an object wrapping the dlgp
    • parseDLGPString

      public static ParserResult parseDLGPString(String dlgpString)
      Parses the DLGP passed as string.
      Parameters:
      dlgpString - string corresponding to the DLGP to parseAll
      Returns:
      an object wrapping the dlgp