org.graphstream.stream.file
Interface FileSink

All Superinterfaces:
AttributeSink, ElementSink, Sink
All Known Implementing Classes:
FileSinkBase, FileSinkDGS, FileSinkDOT, FileSinkDynamicGML, FileSinkGML, FileSinkImages, FileSinkSVG, FileSinkSWF, FileSinkTikZ

public interface FileSink
extends Sink

Output a graph or graph events to a file.

File outputs can work in two modes:


Method Summary
 void begin(OutputStream stream)
          Begin the output of the given stream of graph events.
 void begin(String fileName)
          Begin the output of the given stream of graph events.
 void begin(Writer writer)
          Begin the output of the given stream of graph events.
 void end()
          End the writing process started with begin(OutputStream) or begin(String).
 void flush()
          Ensure all data sent to the output are correctly written.
 void writeAll(Graph graph, OutputStream stream)
          Write the current graph state in one big non-interruptible operation.
 void writeAll(Graph graph, String fileName)
          Write the current graph state in one big non-interruptible operation.
 void writeAll(Graph graph, Writer writer)
          Write the current graph state in one big non-interruptible operation.
 
Methods inherited from interface org.graphstream.stream.AttributeSink
edgeAttributeAdded, edgeAttributeChanged, edgeAttributeRemoved, graphAttributeAdded, graphAttributeChanged, graphAttributeRemoved, nodeAttributeAdded, nodeAttributeChanged, nodeAttributeRemoved
 
Methods inherited from interface org.graphstream.stream.ElementSink
edgeAdded, edgeRemoved, graphCleared, nodeAdded, nodeRemoved, stepBegins
 

Method Detail

writeAll

void writeAll(Graph graph,
              String fileName)
              throws IOException
Write the current graph state in one big non-interruptible operation. This operation is a "snapshot" of the graph, it will never convey the dynamics of the graph. To ensure you store the graph "as it evolves in time" you must use the begin(OutputStream) or begin(String) as soon as the graph appears (or any source of graph event, any descendant of Source will do).

Parameters:
graph - The graph to send as events to the file.
fileName - Name of the file to write.
Throws:
IOException - if an I/O error occurs while writing.

writeAll

void writeAll(Graph graph,
              OutputStream stream)
              throws IOException
Write the current graph state in one big non-interruptible operation. This operation is a "snapshot" of the graph, it will never convey the dynamics of the graph. To ensure you store the graph "as it evolves in time" you must use the begin(Writer) or begin(OutputStream) or begin(String) as soon as the graph appears (or any source of graph event, any descendant of Source will do).

Parameters:
graph - The graph to send as events to the file.
stream - The stream where the graph is sent.
Throws:
IOException - if an I/O error occurs while writing.

writeAll

void writeAll(Graph graph,
              Writer writer)
              throws IOException
Write the current graph state in one big non-interruptible operation. This operation is a "snapshot" of the graph, it will never convey the dynamics of the graph. To ensure you store the graph "as it evolves in time" you must use the begin(Writer) or begin(OutputStream) or begin(String) as soon as the graph appears (or any source of graph event, any descendant of Source will do).

Parameters:
graph - The graph to send as events to the file.
writer - The writer where the graph is sent.
Throws:
IOException - if an I/O error occurs while writing.

begin

void begin(String fileName)
           throws IOException
Begin the output of the given stream of graph events. The graph events can come from any input (implementation of Source or you can directly use the methods inherited from Sink. Once the writing is started using begin(), you must close it using end() when done to ensure data is correctly stored in the file.

Parameters:
fileName - The name of the file where to output the graph events.
Throws:
IOException - If an I/O error occurs while writing.

begin

void begin(OutputStream stream)
           throws IOException
Begin the output of the given stream of graph events. The graph events can come from any input (implementation of Source or you can directly use the methods inherited from Sink. Once the writing is started using begin(), you must close it using end() when done to ensure data is correctly stored in the file.

Parameters:
stream - The file stream where to output the graph events.
Throws:
IOException - If an I/O error occurs while writing.

begin

void begin(Writer writer)
           throws IOException
Begin the output of the given stream of graph events. The graph events can come from any input (implementation of Source or you can directly use the methods inherited from Sink. Once the writing is started using begin(), you must close it using end() when done to ensure data is correctly stored in the file.

Parameters:
writer - The writer where to output the graph events.
Throws:
IOException - If an I/O error occurs while writing.

flush

void flush()
           throws IOException
Ensure all data sent to the output are correctly written.

Throws:
IOException - If an I/O error occurs during write.

end

void end()
         throws IOException
End the writing process started with begin(OutputStream) or begin(String).

Throws:
IOException


Copyright © 2011. All Rights Reserved.