public final class GryoReader extends Object implements GraphReader
GraphReader
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 GryoReader
instance per thread.Modifier and Type | Class and Description |
---|---|
static class |
GryoReader.Builder |
GraphReader.ReaderBuilder<T extends GraphReader>
Modifier and Type | Method and Description |
---|---|
static GryoReader.Builder |
build() |
Edge |
readEdge(InputStream inputStream,
Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Edge>,Edge> edgeAttachMethod)
Read an
Edge from output generated by GryoWriter.writeEdge(OutputStream, Edge) or via
an Edge passed to GryoWriter.writeObject(OutputStream, Object) . |
void |
readGraph(InputStream inputStream,
Graph graphToWriteTo)
Read data into a
Graph from output generated by any of the GryoWriter writeVertex or
writeVertices methods or by GryoWriter.writeGraph(OutputStream, Graph) . |
<C> C |
readObject(InputStream inputStream,
Class<? extends C> clazz)
Reads an arbitrary object using the registered serializers.
|
Property |
readProperty(InputStream inputStream,
Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Property>,Property> propertyAttachMethod)
Read a
Property from output generated by GryoWriter.writeProperty(OutputStream, Property) or
via an Property passed to GryoWriter.writeObject(OutputStream, Object) . |
Vertex |
readVertex(InputStream inputStream,
Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Vertex>,Vertex> vertexAttachMethod)
Read a
Vertex from output generated by any of the GryoWriter writeVertex or
writeVertices methods or by GryoWriter.writeGraph(OutputStream, Graph) . |
Vertex |
readVertex(InputStream inputStream,
Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Vertex>,Vertex> vertexAttachMethod,
Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Edge>,Edge> edgeAttachMethod,
Direction attachEdgesOfThisDirection)
Read a
Vertex from output generated by any of the GryoWriter writeVertex or
writeVertices methods or by GryoWriter.writeGraph(OutputStream, Graph) . |
Optional<Vertex> |
readVertex(InputStream inputStream,
GraphFilter graphFilter)
Reads a single vertex from an
InputStream . |
VertexProperty |
readVertexProperty(InputStream inputStream,
Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<VertexProperty>,VertexProperty> vertexPropertyAttachMethod)
Read a
VertexProperty from output generated by
GryoWriter.writeVertexProperty(OutputStream, VertexProperty) or via an VertexProperty passed
to GryoWriter.writeObject(OutputStream, Object) . |
Iterator<Vertex> |
readVertices(InputStream inputStream,
Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Vertex>,Vertex> vertexAttachMethod,
Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Edge>,Edge> edgeAttachMethod,
Direction attachEdgesOfThisDirection)
Read
Vertex objects from output generated by any of the GryoWriter writeVertex or
writeVertices methods or by GryoWriter.writeGraph(OutputStream, Graph) . |
public void readGraph(InputStream inputStream, Graph graphToWriteTo) throws IOException
Graph
from output generated by any of the GryoWriter
writeVertex
or
writeVertices
methods or by GryoWriter.writeGraph(OutputStream, Graph)
.readGraph
in interface GraphReader
inputStream
- a stream containing an entire graph of vertices and edges as defined by the accompanying
GraphWriter.writeGraph(OutputStream, Graph)
.graphToWriteTo
- the graph to write to when reading from the stream.IOException
public Optional<Vertex> readVertex(InputStream inputStream, GraphFilter graphFilter) throws IOException
GraphReader
InputStream
. This method will filter the read the read vertex by the provided
GraphFilter
. If the graph filter will filter the vertex itself, then the returned Optional
is empty.readVertex
in interface GraphReader
inputStream
- a stream containing at least a single vertex as defined by the accompanying
GraphWriter.writeVertex(OutputStream, Vertex)
.graphFilter
- The GraphFilter
to filter the vertex and its associated edges by.Optional.empty()
if the vertex itself was filtered.IOException
public Iterator<Vertex> readVertices(InputStream inputStream, Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Vertex>,Vertex> vertexAttachMethod, Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection) throws IOException
Vertex
objects from output generated by any of the GryoWriter
writeVertex
or
writeVertices
methods or by GryoWriter.writeGraph(OutputStream, Graph)
.readVertices
in interface GraphReader
inputStream
- a stream containing at least one Vertex
as defined by the accompanying
GraphWriter.writeVertices(OutputStream, Iterator, Direction)
or
GraphWriter.writeVertices(OutputStream, Iterator)
methods.vertexAttachMethod
- a function that creates re-attaches a Vertex
to a Host
object.edgeAttachMethod
- a function that creates re-attaches a Edge
to a Host
object.attachEdgesOfThisDirection
- only edges of this direction are passed to the edgeMaker
.IOException
public Vertex readVertex(InputStream inputStream, Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Vertex>,Vertex> vertexAttachMethod) throws IOException
Vertex
from output generated by any of the GryoWriter
writeVertex
or
writeVertices
methods or by GryoWriter.writeGraph(OutputStream, Graph)
.readVertex
in interface GraphReader
inputStream
- a stream containing at least a single vertex as defined by the accompanying
GraphWriter.writeVertex(OutputStream, Vertex)
.vertexAttachMethod
- a function that creates re-attaches a Vertex
to a Host
object.IOException
public Vertex readVertex(InputStream inputStream, Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Vertex>,Vertex> vertexAttachMethod, Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection) throws IOException
Vertex
from output generated by any of the GryoWriter
writeVertex
or
writeVertices
methods or by GryoWriter.writeGraph(OutputStream, Graph)
.readVertex
in interface GraphReader
inputStream
- a stream containing at least one Vertex
as defined by the accompanying
GraphWriter.writeVertices(OutputStream, Iterator, Direction)
method.vertexAttachMethod
- a function that creates re-attaches a Vertex
to a Host
object.edgeAttachMethod
- a function that creates re-attaches a Edge
to a Host
object.attachEdgesOfThisDirection
- only edges of this direction are passed to the edgeMaker
.IOException
public Edge readEdge(InputStream inputStream, Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Edge>,Edge> edgeAttachMethod) throws IOException
Edge
from output generated by GryoWriter.writeEdge(OutputStream, Edge)
or via
an Edge
passed to GryoWriter.writeObject(OutputStream, Object)
.readEdge
in interface GraphReader
inputStream
- a stream containing at least one Edge
as defined by the accompanying
GraphWriter.writeEdge(OutputStream, Edge)
method.edgeAttachMethod
- a function that creates re-attaches a Edge
to a Host
object.IOException
public VertexProperty readVertexProperty(InputStream inputStream, Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<VertexProperty>,VertexProperty> vertexPropertyAttachMethod) throws IOException
VertexProperty
from output generated by
GryoWriter.writeVertexProperty(OutputStream, VertexProperty)
or via an VertexProperty
passed
to GryoWriter.writeObject(OutputStream, Object)
.readVertexProperty
in interface GraphReader
inputStream
- a stream containing at least one VertexProperty
as written by the accompanying
GraphWriter.writeVertexProperty(OutputStream, VertexProperty)
method.vertexPropertyAttachMethod
- a function that creates re-attaches a VertexProperty
to a
Host
object.IOException
public Property readProperty(InputStream inputStream, Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Property>,Property> propertyAttachMethod) throws IOException
Property
from output generated by GryoWriter.writeProperty(OutputStream, Property)
or
via an Property
passed to GryoWriter.writeObject(OutputStream, Object)
.readProperty
in interface GraphReader
inputStream
- a stream containing at least one Property
as written by the accompanying
GraphWriter.writeProperty(OutputStream, Property)
method.propertyAttachMethod
- a function that creates re-attaches a Property
to a Host
object.IOException
public <C> C readObject(InputStream inputStream, Class<? extends C> clazz) throws IOException
readObject
in interface GraphReader
inputStream
- a stream containing an object.clazz
- the class expected to be in the stream - may or may not be used by the underlying implementation.IOException
public static GryoReader.Builder build()
Copyright © 2013–2020 Apache Software Foundation. All rights reserved.