Class GryoReader
- java.lang.Object
- 
- org.apache.tinkerpop.gremlin.structure.io.gryo.GryoReader
 
- 
- All Implemented Interfaces:
- GraphReader
 
 public final class GryoReader extends Object implements GraphReader TheGraphReaderfor 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 oneGryoReaderinstance per thread.- Author:
- Stephen Mallette (http://stephen.genoprime.com), Marko A. Rodriguez (http://markorodriguez.com)
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classGryoReader.Builder- 
Nested classes/interfaces inherited from interface org.apache.tinkerpop.gremlin.structure.io.GraphReaderGraphReader.ReaderBuilder<T extends GraphReader>
 
- 
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GryoReader.Builderbuild()EdgereadEdge(InputStream inputStream, Function<Attachable<Edge>,Edge> edgeAttachMethod)Read anEdgefrom output generated byGryoWriter.writeEdge(OutputStream, Edge)or via anEdgepassed toGryoWriter.writeObject(OutputStream, Object).voidreadGraph(InputStream inputStream, Graph graphToWriteTo)Read data into aGraphfrom output generated by any of theGryoWriterwriteVertexorwriteVerticesmethods or byGryoWriter.writeGraph(OutputStream, Graph).<C> CreadObject(InputStream inputStream, Class<? extends C> clazz)Reads an arbitrary object using the registered serializers.PropertyreadProperty(InputStream inputStream, Function<Attachable<Property>,Property> propertyAttachMethod)Read aPropertyfrom output generated byGryoWriter.writeProperty(OutputStream, Property)or via anPropertypassed toGryoWriter.writeObject(OutputStream, Object).VertexreadVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod)Read aVertexfrom output generated by any of theGryoWriterwriteVertexorwriteVerticesmethods or byGryoWriter.writeGraph(OutputStream, Graph).VertexreadVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection)Read aVertexfrom output generated by any of theGryoWriterwriteVertexorwriteVerticesmethods or byGryoWriter.writeGraph(OutputStream, Graph).Optional<Vertex>readVertex(InputStream inputStream, GraphFilter graphFilter)Reads a single vertex from anInputStream.VertexPropertyreadVertexProperty(InputStream inputStream, Function<Attachable<VertexProperty>,VertexProperty> vertexPropertyAttachMethod)Read aVertexPropertyfrom output generated byGryoWriter.writeVertexProperty(OutputStream, VertexProperty)or via anVertexPropertypassed toGryoWriter.writeObject(OutputStream, Object).Iterator<Vertex>readVertices(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection)ReadVertexobjects from output generated by any of theGryoWriterwriteVertexorwriteVerticesmethods or byGryoWriter.writeGraph(OutputStream, Graph).
 
- 
- 
- 
Method Detail- 
readGraphpublic void readGraph(InputStream inputStream, Graph graphToWriteTo) throws IOException Read data into aGraphfrom output generated by any of theGryoWriterwriteVertexorwriteVerticesmethods or byGryoWriter.writeGraph(OutputStream, Graph).- Specified by:
- readGraphin interface- GraphReader
- Parameters:
- 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.
- Throws:
- IOException
 
 - 
readVertexpublic Optional<Vertex> readVertex(InputStream inputStream, GraphFilter graphFilter) throws IOException Description copied from interface:GraphReaderReads a single vertex from anInputStream. This method will filter the read the read vertex by the providedGraphFilter. If the graph filter will filter the vertex itself, then the returnedOptionalis empty.- Specified by:
- readVertexin interface- GraphReader
- Parameters:
- inputStream- a stream containing at least a single vertex as defined by the accompanying- GraphWriter.writeVertex(OutputStream, Vertex).
- graphFilter- The- GraphFilterto filter the vertex and its associated edges by.
- Returns:
- the vertex with filtered edges or Optional.empty()if the vertex itself was filtered.
- Throws:
- IOException
 
 - 
readVerticespublic Iterator<Vertex> readVertices(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection) throws IOException ReadVertexobjects from output generated by any of theGryoWriterwriteVertexorwriteVerticesmethods or byGryoWriter.writeGraph(OutputStream, Graph).- Specified by:
- readVerticesin interface- GraphReader
- Parameters:
- inputStream- a stream containing at least one- Vertexas defined by the accompanying- GraphWriter.writeVertices(OutputStream, Iterator, Direction)or- GraphWriter.writeVertices(OutputStream, Iterator)methods.
- vertexAttachMethod- a function that creates re-attaches a- Vertexto a- Hostobject.
- edgeAttachMethod- a function that creates re-attaches a- Edgeto a- Hostobject.
- attachEdgesOfThisDirection- only edges of this direction are passed to the- edgeMaker.
- Throws:
- IOException
 
 - 
readVertexpublic Vertex readVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod) throws IOException Read aVertexfrom output generated by any of theGryoWriterwriteVertexorwriteVerticesmethods or byGryoWriter.writeGraph(OutputStream, Graph).- Specified by:
- readVertexin interface- GraphReader
- Parameters:
- 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- Vertexto a- Hostobject.
- Throws:
- IOException
 
 - 
readVertexpublic Vertex readVertex(InputStream inputStream, Function<Attachable<Vertex>,Vertex> vertexAttachMethod, Function<Attachable<Edge>,Edge> edgeAttachMethod, Direction attachEdgesOfThisDirection) throws IOException Read aVertexfrom output generated by any of theGryoWriterwriteVertexorwriteVerticesmethods or byGryoWriter.writeGraph(OutputStream, Graph).- Specified by:
- readVertexin interface- GraphReader
- Parameters:
- inputStream- a stream containing at least one- Vertexas defined by the accompanying- GraphWriter.writeVertices(OutputStream, Iterator, Direction)method.
- vertexAttachMethod- a function that creates re-attaches a- Vertexto a- Hostobject.
- edgeAttachMethod- a function that creates re-attaches a- Edgeto a- Hostobject.
- attachEdgesOfThisDirection- only edges of this direction are passed to the- edgeMaker.
- Throws:
- IOException
 
 - 
readEdgepublic Edge readEdge(InputStream inputStream, Function<Attachable<Edge>,Edge> edgeAttachMethod) throws IOException Read anEdgefrom output generated byGryoWriter.writeEdge(OutputStream, Edge)or via anEdgepassed toGryoWriter.writeObject(OutputStream, Object).- Specified by:
- readEdgein interface- GraphReader
- Parameters:
- inputStream- a stream containing at least one- Edgeas defined by the accompanying- GraphWriter.writeEdge(OutputStream, Edge)method.
- edgeAttachMethod- a function that creates re-attaches a- Edgeto a- Hostobject.
- Throws:
- IOException
 
 - 
readVertexPropertypublic VertexProperty readVertexProperty(InputStream inputStream, Function<Attachable<VertexProperty>,VertexProperty> vertexPropertyAttachMethod) throws IOException Read aVertexPropertyfrom output generated byGryoWriter.writeVertexProperty(OutputStream, VertexProperty)or via anVertexPropertypassed toGryoWriter.writeObject(OutputStream, Object).- Specified by:
- readVertexPropertyin interface- GraphReader
- Parameters:
- inputStream- a stream containing at least one- VertexPropertyas written by the accompanying- GraphWriter.writeVertexProperty(OutputStream, VertexProperty)method.
- vertexPropertyAttachMethod- a function that creates re-attaches a- VertexPropertyto a- Hostobject.
- Returns:
- the value returned by the attach method.
- Throws:
- IOException
 
 - 
readPropertypublic Property readProperty(InputStream inputStream, Function<Attachable<Property>,Property> propertyAttachMethod) throws IOException Read aPropertyfrom output generated byGryoWriter.writeProperty(OutputStream, Property)or via anPropertypassed toGryoWriter.writeObject(OutputStream, Object).- Specified by:
- readPropertyin interface- GraphReader
- Parameters:
- inputStream- a stream containing at least one- Propertyas written by the accompanying- GraphWriter.writeProperty(OutputStream, Property)method.
- propertyAttachMethod- a function that creates re-attaches a- Propertyto a- Hostobject.
- Returns:
- the value returned by the attach method.
- Throws:
- IOException
 
 - 
readObjectpublic <C> C readObject(InputStream inputStream, Class<? extends C> clazz) throws IOException Reads an arbitrary object using the registered serializers.- Specified by:
- readObjectin interface- GraphReader
- Parameters:
- 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.
- Throws:
- IOException
 
 - 
buildpublic static GryoReader.Builder build() 
 
- 
 
-