public final class GryoWriter extends Object implements GraphWriter
GraphWriter
for the Gremlin Structure serialization format based on Kryo. The format is meant to be
non-lossy in terms of Gremlin Structure to Gremlin Structure migrations (assuming both structure implementations
support the same graph features).
This implementation is not thread-safe. Have one GraphWriter
instance per thread.Modifier and Type | Class and Description |
---|---|
static class |
GryoWriter.Builder |
GraphWriter.WriterBuilder<T extends GraphWriter>
Modifier and Type | Method and Description |
---|---|
static GryoWriter.Builder |
build() |
void |
writeEdge(OutputStream outputStream,
Edge e)
Write an edge to a stream.
|
void |
writeGraph(OutputStream outputStream,
Graph g)
Write the entire graph to a stream.
|
void |
writeObject(OutputStream outputStream,
Object object)
Writes an arbitrary object to the stream.
|
void |
writeProperty(OutputStream outputStream,
Property p)
Write a property to a stream.
|
void |
writeVertex(OutputStream outputStream,
Vertex v)
Write a vertex to a stream without writing its edges.
|
void |
writeVertex(OutputStream outputStream,
Vertex v,
Direction direction)
Write a vertex to a stream with its associated edges.
|
void |
writeVertexProperty(OutputStream outputStream,
VertexProperty vp)
Write a vertex property to a stream.
|
void |
writeVertices(OutputStream outputStream,
Iterator<Vertex> vertexIterator)
Write a vertex to a stream without writing its edges.
|
void |
writeVertices(OutputStream outputStream,
Iterator<Vertex> vertexIterator,
Direction direction)
Write a list of vertices from a
Traversal to a stream with its associated edges. |
public void writeGraph(OutputStream outputStream, Graph g) throws IOException
writeGraph
in interface GraphWriter
outputStream
- the stream to write to.g
- the graph to write to stream.IOException
public void writeVertices(OutputStream outputStream, Iterator<Vertex> vertexIterator, Direction direction) throws IOException
Traversal
to a stream with its associated edges. Only write edges as
defined by the requested direction.writeVertices
in interface GraphWriter
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.IOException
public void writeVertices(OutputStream outputStream, Iterator<Vertex> vertexIterator) throws IOException
writeVertices
in interface GraphWriter
outputStream
- the stream to write to.vertexIterator
- a iterator that returns a list of vertices.IOException
public void writeVertex(OutputStream outputStream, Vertex v, Direction direction) throws IOException
writeVertex
in interface GraphWriter
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.IOException
public void writeVertex(OutputStream outputStream, Vertex v) throws IOException
writeVertex
in interface GraphWriter
outputStream
- the stream to write to.v
- the vertex to write.IOException
public void writeEdge(OutputStream outputStream, Edge e) throws IOException
writeEdge
in interface GraphWriter
outputStream
- the stream to write to.e
- the edge to write.IOException
public void writeVertexProperty(OutputStream outputStream, VertexProperty vp) throws IOException
writeVertexProperty
in interface GraphWriter
outputStream
- the stream to write to.vp
- the vertex property to write.IOException
public void writeProperty(OutputStream outputStream, Property p) throws IOException
writeProperty
in interface GraphWriter
outputStream
- the stream to write to.p
- the property to write.IOException
public void writeObject(OutputStream outputStream, Object object)
writeObject
in interface GraphWriter
outputStream
- the stream to write to.object
- the object to write which will use the standard serializer set.public static GryoWriter.Builder build()
Copyright © 2013–2022 Apache Software Foundation. All rights reserved.