public final class GraphSONReader extends Object implements GraphReader
Edge
and Vertex
objects are serialized to Map
instances. If an
Element
is used as a key, it is coerced to its identifier. Other complex
objects are converted via Object.toString()
unless there is a mapper serializer supplied.Modifier and Type | Class and Description |
---|---|
static class |
GraphSONReader.Builder |
GraphReader.ReaderBuilder<T extends GraphReader>
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readVertex
public void readGraph(InputStream inputStream, Graph graphToWriteTo) throws IOException
Graph
from output generated by any of the GraphSONWriter
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
GraphSONWriter.writeGraph(OutputStream, Graph)
.graphToWriteTo
- the graph to write to when reading from the stream.IOException
public 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 GraphSONWriter
writeVertex
or
writeVertices
methods or by GraphSONWriter.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<Attachable<Vertex>,Vertex> vertexAttachMethod) throws IOException
Vertex
from output generated by any of the GraphSONWriter
writeVertex
or
writeVertices
methods or by GraphSONWriter.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<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection) throws IOException
Vertex
from output generated by any of the GraphSONWriter
writeVertex
or
writeVertices
methods or by GraphSONWriter.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<Attachable<Edge>,Edge> edgeAttachMethod) throws IOException
Edge
from output generated by GraphSONWriter.writeEdge(OutputStream, Edge)
or via
an Edge
passed to GraphSONWriter.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<Attachable<VertexProperty>,VertexProperty> vertexPropertyAttachMethod) throws IOException
VertexProperty
from output generated by
GraphSONWriter.writeVertexProperty(OutputStream, VertexProperty)
or via an VertexProperty
passed
to GraphSONWriter.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<Attachable<Property>,Property> propertyAttachMethod) throws IOException
Property
from output generated by GraphSONWriter.writeProperty(OutputStream, Property)
or
via an Property
passed to GraphSONWriter.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 GraphSONReader.Builder build()
Copyright © 2013–2016 Apache Software Foundation. All rights reserved.