org.graphstream.stream.file
Class FileSourceGraphML

java.lang.Object
  extended by org.graphstream.stream.SourceBase
      extended by org.graphstream.stream.file.FileSourceGraphML
All Implemented Interfaces:
javax.xml.stream.XMLStreamConstants, FileSource, Source

public class FileSourceGraphML
extends SourceBase
implements FileSource, javax.xml.stream.XMLStreamConstants

GraphML is a comprehensive and easy-to-use file format for graphs. It consists of a language core to describe the structural properties of a graph and a flexible extension mechanism to add application-specific data. Its main features include support of

Unlike many other file formats for graphs, GraphML does not use a custom syntax. Instead, it is based on XML and hence ideally suited as a common denominator for all kinds of services generating, archiving, or processing graphs. Source


Nested Class Summary
 
Nested classes/interfaces inherited from class org.graphstream.stream.SourceBase
SourceBase.ElementType
 
Field Summary
 
Fields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT
 
Constructor Summary
FileSourceGraphML()
          Build a new source to parse an xml stream in GraphML format.
 
Method Summary
 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 if FileSource.nextEvents() or FileSource.nextStep() did not returned false).
 boolean nextEvents()
          Try to process one graph event, or as few as possible, if more must be read at once.
 boolean nextStep()
          Try to process all the events occurring during one time step.
 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, sendEdgeRemoved, sendEdgeRemoved, sendGraphCleared, sendGraphCleared, sendNodeAdded, sendNodeAdded, 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
 

Constructor Detail

FileSourceGraphML

public FileSourceGraphML()
Build a new source to parse an xml stream in GraphML format.

Method Detail

readAll

public void readAll(String fileName)
             throws IOException
Description copied from interface: FileSource
Read the whole file in one big non-interruptible operation.

Specified by:
readAll in interface FileSource
Parameters:
fileName - Name of the file to read.
Throws:
IOException - If an I/O error occurs while reading.

readAll

public void readAll(URL url)
             throws IOException
Description copied from interface: FileSource
Read the whole file in one big non-interruptible operation.

Specified by:
readAll in interface FileSource
Parameters:
url - The URL of the file to read.
Throws:
IOException - If an I/O error occurs while reading.

readAll

public void readAll(InputStream stream)
             throws IOException
Description copied from interface: FileSource
Read the whole file in one big non-interruptible operation.

Specified by:
readAll in interface FileSource
Parameters:
stream - The input stream to use for reading.
Throws:
IOException - If an I/O error occurs while reading.

readAll

public void readAll(Reader reader)
             throws IOException
Description copied from interface: FileSource
Read the whole file in one big non-interruptible operation.

Specified by:
readAll in interface FileSource
Parameters:
reader - The reader to use.
Throws:
IOException - If an I/O error occurs while reading.

begin

public void begin(String fileName)
           throws IOException
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 calling FileSource.nextEvents() or FileSource.nextStep(). Once begin() has been called, you must finish the reading process using FileSource.end(). You cannot call begin() twice without having called FileSource.end() in between.

Specified by:
begin in interface FileSource
Parameters:
fileName - Name of the file to read.
Throws:
IOException - If an I/O error occurs while reading.

begin

public void begin(URL url)
           throws IOException
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 calling FileSource.nextEvents() or FileSource.nextStep(). Once begin() has been called, you must finish the reading process using FileSource.end(). You cannot call begin() twice without having called FileSource.end() in between.

Specified by:
begin in interface FileSource
Parameters:
url - The URL of the file to read.
Throws:
IOException - If an I/O error occurs while reading.

begin

public void begin(InputStream stream)
           throws IOException
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 calling FileSource.nextEvents() or FileSource.nextStep(). Once begin() has been called, you must finish the reading process using FileSource.end(). You cannot call begin() twice without having called FileSource.end() in between.

Specified by:
begin in interface FileSource
Parameters:
stream - The input stream to use for reading.
Throws:
IOException - If an I/O error occurs while reading.

begin

public void begin(Reader reader)
           throws IOException
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 calling FileSource.nextEvents() or FileSource.nextStep(). Once begin() has been called, you must finish the reading process using FileSource.end(). You cannot call begin() twice without having called FileSource.end() in between.

Specified by:
begin in interface FileSource
Parameters:
reader - The file reader to use.
Throws:
IOException - If an I/O error occurs while reading.

nextEvents

public boolean nextEvents()
                   throws IOException
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 called FileSource.begin(InputStream) or FileSource.begin(String) before. This method return true while there are still events to read.

Specified by:
nextEvents in interface FileSource
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

public boolean nextStep()
                 throws IOException
Description copied from interface: FileSource
Try to process all the events occurring during one time step. In GraphStream, a time step is a group of events that are considered occurring at the same time. Most file formats do not have this notion of step. The DGS format designed for GraphStream handles steps. This method return true while there are still events to read.

Specified by:
nextStep in interface FileSource
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

public void end()
         throws IOException
Description copied from interface: FileSource
Finish the reading process (even if FileSource.nextEvents() or FileSource.nextStep() did not returned false). You must call this method after reading.

Specified by:
end in interface FileSource
Throws:
IOException - If an I/O error occurs while closing the file.


Copyright © 2011. All Rights Reserved.