public interface GraphReader
readVertex(InputStream, Function)
} need not also
be readable by readObject(InputStream, Class)
. 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 "write" operation in GraphWriter
be capable of
writing output compatible to its reader. In other words, the output of
GraphWriter.writeObject(OutputStream, Object)
should always be readable by
readObject(InputStream, Class)
and the output of GraphWriter.writeGraph(OutputStream, Graph)
should always be readable by readGraph(InputStream, Graph)
.Modifier and Type | Interface and Description |
---|---|
static interface |
GraphReader.ReaderBuilder<T extends GraphReader>
Largely a marker interface for builder classes that construct a
GraphReader . |
Modifier and Type | Method and Description |
---|---|
Edge |
readEdge(InputStream inputStream,
Function<Attachable<Edge>,Edge> edgeAttachMethod)
Reads a single edge from an
InputStream . |
void |
readGraph(InputStream inputStream,
Graph graphToWriteTo)
Reads an entire graph from an
InputStream . |
<C> C |
readObject(InputStream inputStream,
Class<? extends C> clazz)
Reads an arbitrary object using the registered serializers.
|
Property |
readProperty(InputStream inputStream,
Function<Attachable<Property>,Property> propertyAttachMethod)
Reads a single property from an
InputStream . |
Vertex |
readVertex(InputStream inputStream,
Function<Attachable<Vertex>,Vertex> vertexAttachMethod)
Reads a single vertex from an
InputStream . |
Vertex |
readVertex(InputStream inputStream,
Function<Attachable<Vertex>,Vertex> vertexAttachMethod,
Function<Attachable<Edge>,Edge> edgeAttachMethod,
Direction attachEdgesOfThisDirection)
Reads a single vertex from an
InputStream . |
default Optional<Vertex> |
readVertex(InputStream inputStream,
GraphFilter graphFilter)
Reads a single vertex from an
InputStream . |
VertexProperty |
readVertexProperty(InputStream inputStream,
Function<Attachable<VertexProperty>,VertexProperty> vertexPropertyAttachMethod)
Reads a single vertex property from an
InputStream . |
Iterator<Vertex> |
readVertices(InputStream inputStream,
Function<Attachable<Vertex>,Vertex> vertexAttachMethod,
Function<Attachable<Edge>,Edge> edgeAttachMethod,
Direction attachEdgesOfThisDirection)
Reads a set of one or more vertices from an
InputStream which were written by
GraphWriter.writeVertices(OutputStream, Iterator) . |
void readGraph(InputStream inputStream, Graph graphToWriteTo) throws IOException
InputStream
. This method is mean to load an empty Graph
.
It is up to individual implementations to manage transactions, but it is not required or enforced. Consult
the documentation of an implementation to understand the approach it takes.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
default Optional<Vertex> readVertex(InputStream inputStream, GraphFilter graphFilter) throws IOException
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.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
Vertex readVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod) throws IOException
InputStream
. This method will read vertex properties but not edges.
It is expected that the user will manager their own transaction context with respect to this method (i.e.
implementations should not commit the transaction for the user).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
Vertex readVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection) throws IOException
InputStream
. This method will read vertex properties as well as edges
given the direction supplied as an argument. It is expected that the user will manager their own transaction
context with respect to this method (i.e. implementations should not commit the transaction for the user).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
Iterator<Vertex> readVertices(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection) throws IOException
InputStream
which were written by
GraphWriter.writeVertices(OutputStream, Iterator)
. This method will read vertex properties as well as
edges given the direction supplied as an argument. It is expected that the user will manager their own
transaction context with respect to this method (i.e. implementations should not commit the transaction for
the user).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
Edge readEdge(InputStream inputStream, Function<Attachable<Edge>,Edge> edgeAttachMethod) throws IOException
InputStream
. It is expected that the user will manager their own
transaction context with respect to this method (i.e. implementations should not commit the transaction for
the user).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
VertexProperty readVertexProperty(InputStream inputStream, Function<Attachable<VertexProperty>,VertexProperty> vertexPropertyAttachMethod) throws IOException
InputStream
. It is expected that the user will manager their own
transaction context with respect to this method (i.e. implementations should not commit the transaction for
the user).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
Property readProperty(InputStream inputStream, Function<Attachable<Property>,Property> propertyAttachMethod) throws IOException
InputStream
. It is expected that the user will manager their own
transaction context with respect to this method (i.e. implementations should not commit the transaction for
the user).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
<C> C readObject(InputStream inputStream, Class<? extends C> clazz) throws IOException
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
Copyright © 2013–2019 Apache Software Foundation. All rights reserved.