Interface GraphWriter
- 
- All Known Implementing Classes:
- GraphMLWriter,- GraphSONWriter,- GryoWriter
 
 public interface GraphWriterFunctions for writing a graph and its elements to a serialized format. Implementations of this class do not need to explicitly guarantee that an object written with one method must have its format equivalent to another. In other words, callingwriteVertex(OutputStream, Vertex)} need not have equivalent output towriteObject(OutputStream, Object). Nor does the representation of anEdgewithin the output ofwriteVertex(OutputStream, Vertex, Direction)need to match the representation of that sameEdgewhen provided towriteEdge(OutputStream, Edge). In other words, implementations are free to optimize as is possible for a specific serialization method. That said, it is however important that the complementary "read" operation inGraphReaderbe capable of reading the output of the writer. In other words, the output ofwriteObject(OutputStream, Object)should always be readable byGraphReader.readObject(InputStream, Class)and the output ofwriteGraph(OutputStream, Graph)should always be readable byGraphReader.readGraph(InputStream, Graph).- Author:
- Stephen Mallette (http://stephen.genoprime.com)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceGraphWriter.WriterBuilder<T extends GraphWriter>Largely a marker interface for builder classes that construct aGraphWriter.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidwriteEdge(OutputStream outputStream, Edge e)Write an edge to a stream.voidwriteGraph(OutputStream outputStream, Graph g)Write the entire graph to a stream.voidwriteObject(OutputStream outputStream, Object object)Writes an arbitrary object to the stream.voidwriteProperty(OutputStream outputStream, Property p)Write a property to a stream.voidwriteVertex(OutputStream outputStream, Vertex v)Write a vertex to a stream without writing its edges.voidwriteVertex(OutputStream outputStream, Vertex v, Direction direction)Write a vertex to a stream with its associated edges.voidwriteVertexProperty(OutputStream outputStream, VertexProperty vp)Write a vertex property to a stream.default voidwriteVertices(OutputStream outputStream, Iterator<Vertex> vertexIterator)Write a vertex to a stream without writing its edges.default voidwriteVertices(OutputStream outputStream, Iterator<Vertex> vertexIterator, Direction direction)Write a list of vertices from aTraversalto a stream with its associated edges.
 
- 
- 
- 
Method Detail- 
writeGraphvoid writeGraph(OutputStream outputStream, Graph g) throws IOException Write the entire graph to a stream.- Parameters:
- outputStream- the stream to write to.
- g- the graph to write to stream.
- Throws:
- IOException
 
 - 
writeVertexvoid writeVertex(OutputStream outputStream, Vertex v, Direction direction) throws IOException Write a vertex to a stream with its associated edges. Only write edges as defined by the requested direction.- Parameters:
- outputStream- the stream to write to.
- v- the vertex to write.
- direction- the direction of edges to write or null if no edges are to be written.
- Throws:
- IOException
 
 - 
writeVertexvoid writeVertex(OutputStream outputStream, Vertex v) throws IOException Write a vertex to a stream without writing its edges.- Parameters:
- outputStream- the stream to write to.
- v- the vertex to write.
- Throws:
- IOException
 
 - 
writeVerticesdefault void writeVertices(OutputStream outputStream, Iterator<Vertex> vertexIterator, Direction direction) throws IOException Write a list of vertices from aTraversalto a stream with its associated edges. Only write edges as defined by the requested direction.- Parameters:
- outputStream- the stream to write to.
- vertexIterator- a traversal that returns a list of vertices.
- direction- the direction of edges to write or null if no edges are to be written.
- Throws:
- IOException
 
 - 
writeVerticesdefault void writeVertices(OutputStream outputStream, Iterator<Vertex> vertexIterator) throws IOException Write a vertex to a stream without writing its edges.- Parameters:
- outputStream- the stream to write to.
- vertexIterator- a iterator that returns a list of vertices.
- Throws:
- IOException
 
 - 
writeEdgevoid writeEdge(OutputStream outputStream, Edge e) throws IOException Write an edge to a stream.- Parameters:
- outputStream- the stream to write to.
- e- the edge to write.
- Throws:
- IOException
 
 - 
writeVertexPropertyvoid writeVertexProperty(OutputStream outputStream, VertexProperty vp) throws IOException Write a vertex property to a stream.- Parameters:
- outputStream- the stream to write to.
- vp- the vertex property to write.
- Throws:
- IOException
 
 - 
writePropertyvoid writeProperty(OutputStream outputStream, Property p) throws IOException Write a property to a stream.- Parameters:
- outputStream- the stream to write to.
- p- the property to write.
- Throws:
- IOException
 
 - 
writeObjectvoid writeObject(OutputStream outputStream, Object object) throws IOException Writes an arbitrary object to the stream.- Parameters:
- outputStream- the stream to write to.
- object- the object to write which will use the standard serializer set.
- Throws:
- IOException
 
 
- 
 
-