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>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 GraphReaderinputStream - 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.IOExceptionpublic Optional<Vertex> readVertex(InputStream inputStream, GraphFilter graphFilter) throws IOException
GraphReaderInputStream. 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 GraphReaderinputStream - 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.IOExceptionpublic Iterator<Vertex> readVertices(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<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 GraphReaderinputStream - 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.IOExceptionpublic Vertex readVertex(InputStream inputStream, Function<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 GraphReaderinputStream - 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.IOExceptionpublic Vertex readVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<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 GraphReaderinputStream - 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.IOExceptionpublic Edge readEdge(InputStream inputStream, Function<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 GraphReaderinputStream - 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.IOExceptionpublic VertexProperty readVertexProperty(InputStream inputStream, Function<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 GraphReaderinputStream - 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.IOExceptionpublic Property readProperty(InputStream inputStream, Function<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 GraphReaderinputStream - 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.IOExceptionpublic <C> C readObject(InputStream inputStream, Class<? extends C> clazz) throws IOException
readObject in interface GraphReaderinputStream - a stream containing an object.clazz - the class expected to be in the stream - may or may not be used by the underlying implementation.IOExceptionpublic static GryoReader.Builder build()
Copyright © 2013–2016 Apache Software Foundation. All rights reserved.