Class DlgpParser
java.lang.Object
fr.inria.rules.integraal.util.stream.AbstractCloseableIterator<Object>
fr.inria.rules.integraal.io.dlgp.DlgpParser
- All Implemented Interfaces:
Parser<Object>, CloseableIterator<Object>, Closeable, AutoCloseable
Main access point of the DLGP parser.
- Author:
- Florent Tornil
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for parsing from the standard input.DlgpParser(File file) Constructor for parsing from the given file.Constructor for parsing the given InputStream.DlgpParser(Reader reader) Constructor for parsing from the given reader.DlgpParser(String s) Constructor for parsing the content of the string s as DLGP content. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the stream and releases any system resources associated with it.protected voidfinalize()booleanhasNext()Indicates whether another element can be read from the iterator.next()Returns the next element from the iterator.static ParserResultparseDLGPString(String dlgpString) Parses the DLGP passed as string.static ParserResultParses 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.static ParserResultparseFiles(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.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Parser
parse, streamParsedObjects
-
Constructor Details
-
DlgpParser
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
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
Constructor for parsing the content of the string s as DLGP content.- Parameters:
s- a DLGP input as String
-
DlgpParser
Constructor for parsing the given InputStream.- Parameters:
in- java InputStream to read from
-
-
Method Details
-
finalize
- Overrides:
finalizein classAbstractCloseableIterator<Object>- Throws:
Throwable
-
hasNext
public boolean hasNext()Description copied from interface:CloseableIteratorIndicates whether another element can be read from the iterator. -
next
Description copied from interface:CloseableIteratorReturns the next element from the iterator.- Specified by:
nextin interfaceCloseableIterator<Object>- Specified by:
nextin interfaceParser<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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCloseableIterator<Object>
-
parseFile
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
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
Parses the DLGP passed as string.- Parameters:
dlgpString- string corresponding to the DLGP to parseAll- Returns:
- an object wrapping the dlgp
-