Package org.graphstream.stream.file
Class FileSourceParser
java.lang.Object
org.graphstream.stream.SourceBase
org.graphstream.stream.file.FileSourceParser
- All Implemented Interfaces:
FileSource
,Source
- Direct Known Subclasses:
FileSourceDGS
,FileSourceDOT
,FileSourceGML
,FileSourcePajek
,FileSourceTLP
public abstract class FileSourceParser extends SourceBase implements FileSource
This defines source using a
Parser
object
to parse a stream and generate graph events.-
Nested Class Summary
Nested classes/interfaces inherited from class org.graphstream.stream.SourceBase
SourceBase.ElementType
-
Method Summary
Modifier and Type Method Description void
begin(InputStream stream)
Begin reading the file stopping as soon as possible.void
begin(Reader reader)
Begin reading the file stopping as soon as possible.void
begin(String fileName)
Begin reading the file stopping as soon as possible.void
begin(URL url)
Begin reading the file stopping as soon as possible.void
end()
Finish the reading process (even ifFileSource.nextEvents()
orFileSource.nextStep()
did not returned false).abstract ParserFactory
getNewParserFactory()
Get a new parser factory.boolean
nextEvents()
Try to process one graph event, or as few as possible, if more must be read at once.boolean
nextStep()
Since there is no step in DOT, this does the same action thannextEvents()
.void
readAll(InputStream stream)
Read the whole file in one big non-interruptible operation.void
readAll(Reader reader)
Read the whole file in one big non-interruptible operation.void
readAll(String fileName)
Read the whole file in one big non-interruptible operation.void
readAll(URL url)
Read the whole file in one big non-interruptible operation.Methods inherited from class org.graphstream.stream.SourceBase
addAttributeSink, addElementSink, addSink, attributeSinks, clearAttributeSinks, clearElementSinks, clearSinks, elementSinks, removeAttributeSink, removeElementSink, removeSink, sendAttributeChangedEvent, sendAttributeChangedEvent, sendEdgeAdded, sendEdgeAdded, sendEdgeAttributeAdded, sendEdgeAttributeAdded, sendEdgeAttributeChanged, sendEdgeAttributeChanged, sendEdgeAttributeRemoved, sendEdgeAttributeRemoved, sendEdgeRemoved, sendEdgeRemoved, sendGraphAttributeAdded, sendGraphAttributeAdded, sendGraphAttributeChanged, sendGraphAttributeChanged, sendGraphAttributeRemoved, sendGraphAttributeRemoved, sendGraphCleared, sendGraphCleared, sendNodeAdded, sendNodeAdded, sendNodeAttributeAdded, sendNodeAttributeAdded, sendNodeAttributeChanged, sendNodeAttributeChanged, sendNodeAttributeRemoved, sendNodeAttributeRemoved, sendNodeRemoved, sendNodeRemoved, sendStepBegins, sendStepBegins
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.graphstream.stream.Source
addAttributeSink, addElementSink, addSink, clearAttributeSinks, clearElementSinks, clearSinks, removeAttributeSink, removeElementSink, removeSink
-
Method Details
-
getNewParserFactory
Get a new parser factory.- Returns:
- a parser factory
-
readAll
Description copied from interface:FileSource
Read the whole file in one big non-interruptible operation.- Specified by:
readAll
in interfaceFileSource
- Parameters:
fileName
- Name of the file to read.- Throws:
IOException
- If an I/O error occurs while reading.
-
readAll
Description copied from interface:FileSource
Read the whole file in one big non-interruptible operation.- Specified by:
readAll
in interfaceFileSource
- Parameters:
url
- The URL of the file to read.- Throws:
IOException
- If an I/O error occurs while reading.
-
readAll
Description copied from interface:FileSource
Read the whole file in one big non-interruptible operation.- Specified by:
readAll
in interfaceFileSource
- Parameters:
stream
- The input stream to use for reading.- Throws:
IOException
- If an I/O error occurs while reading.
-
readAll
Description copied from interface:FileSource
Read the whole file in one big non-interruptible operation.- Specified by:
readAll
in interfaceFileSource
- Parameters:
reader
- The reader to use.- Throws:
IOException
- If an I/O error occurs while reading.
-
begin
Description copied from interface:FileSource
Begin reading the file stopping as soon as possible. Next graph events stored in the file will be sent by callingFileSource.nextEvents()
orFileSource.nextStep()
. Once begin() has been called, you must finish the reading process usingFileSource.end()
. You cannot call begin() twice without having calledFileSource.end()
in between.- Specified by:
begin
in interfaceFileSource
- Parameters:
fileName
- Name of the file to read.- Throws:
IOException
- If an I/O error occurs while reading.
-
begin
Description copied from interface:FileSource
Begin reading the file stopping as soon as possible. Next graph events stored in the file will be sent by callingFileSource.nextEvents()
orFileSource.nextStep()
. Once begin() has been called, you must finish the reading process usingFileSource.end()
. You cannot call begin() twice without having calledFileSource.end()
in between.- Specified by:
begin
in interfaceFileSource
- Parameters:
url
- The URL of the file to read.- Throws:
IOException
- If an I/O error occurs while reading.
-
begin
Description copied from interface:FileSource
Begin reading the file stopping as soon as possible. Next graph events stored in the file will be sent by callingFileSource.nextEvents()
orFileSource.nextStep()
. Once begin() has been called, you must finish the reading process usingFileSource.end()
. You cannot call begin() twice without having calledFileSource.end()
in between.- Specified by:
begin
in interfaceFileSource
- Parameters:
stream
- The input stream to use for reading.- Throws:
IOException
- If an I/O error occurs while reading.
-
begin
Description copied from interface:FileSource
Begin reading the file stopping as soon as possible. Next graph events stored in the file will be sent by callingFileSource.nextEvents()
orFileSource.nextStep()
. Once begin() has been called, you must finish the reading process usingFileSource.end()
. You cannot call begin() twice without having calledFileSource.end()
in between.- Specified by:
begin
in interfaceFileSource
- Parameters:
reader
- The file reader to use.- Throws:
IOException
- If an I/O error occurs while reading.
-
nextEvents
Description copied from interface:FileSource
Try to process one graph event, or as few as possible, if more must be read at once. For this method to work, you must have calledFileSource.begin(InputStream)
orFileSource.begin(String)
before. This method return true while there are still events to read.- Specified by:
nextEvents
in interfaceFileSource
- Returns:
- true if there are still events to read, false as soon as the file is finished.
- Throws:
IOException
- If an I/O error occurs while reading.
-
nextStep
Since there is no step in DOT, this does the same action thannextEvents()
.- Specified by:
nextStep
in interfaceFileSource
- Returns:
- true if there are still events to read, false as soon as the file is finished.
- Throws:
IOException
- If an I/O error occurs while reading.
-
end
Description copied from interface:FileSource
Finish the reading process (even ifFileSource.nextEvents()
orFileSource.nextStep()
did not returned false). You must call this method after reading.- Specified by:
end
in interfaceFileSource
- Throws:
IOException
- If an I/O error occurs while closing the file.
-