Package org.graphstream.stream.file
Interface FileSink
- All Superinterfaces:
AttributeSink
,ElementSink
,Sink
- All Known Implementing Classes:
FileSinkBase
,FileSinkBaseFiltered
,FileSinkDGS
,FileSinkDGSFiltered
,FileSinkDOT
,FileSinkDynamicGML
,FileSinkGEXF
,FileSinkGEXF2
,FileSinkGML
,FileSinkGraphML
,FileSinkImages
,FileSinkSVG
,FileSinkTikZ
,FileSinkUnstyledSVG
public interface FileSink extends Sink
Output a graph or graph events to a file.
File outputs can work in two modes:
- In the "writeAll()" mode, the file output is done "all at once" writing a "snapshot" of the graph at this particular instant in time. This mode cannot convey the dynamics of the graph.
- In "begin()/end()" mode, the output is listener of an input (a graph or any other sort of graph events producer) and it write events as they come, conveying the dynamics of the graph correctly.
-
Method Summary
Modifier and Type Method Description void
begin(OutputStream stream)
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
begin(String fileName)
Begin the output of the given stream of graph events.void
end()
End the writing process started withbegin(OutputStream)
orbegin(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, Writer writer)
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.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 Details
-
writeAll
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 thebegin(OutputStream)
orbegin(String)
as soon as the graph appears (or any source of graph event, any descendant ofSource
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
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 thebegin(Writer)
orbegin(OutputStream)
orbegin(String)
as soon as the graph appears (or any source of graph event, any descendant ofSource
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
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 thebegin(Writer)
orbegin(OutputStream)
orbegin(String)
as soon as the graph appears (or any source of graph event, any descendant ofSource
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
Begin the output of the given stream of graph events. The graph events can come from any input (implementation ofSource
or you can directly use the methods inherited fromSink
. Once the writing is started using begin(), you must close it usingend()
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
Begin the output of the given stream of graph events. The graph events can come from any input (implementation ofSource
or you can directly use the methods inherited fromSink
. Once the writing is started using begin(), you must close it usingend()
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
Begin the output of the given stream of graph events. The graph events can come from any input (implementation ofSource
or you can directly use the methods inherited fromSink
. Once the writing is started using begin(), you must close it usingend()
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
Ensure all data sent to the output are correctly written.- Throws:
IOException
- If an I/O error occurs during write.
-
end
End the writing process started withbegin(OutputStream)
orbegin(String)
.- Throws:
IOException
-