Interface GraphReader

    • Method Detail

      • readGraph

        void readGraph​(InputStream inputStream,
                       Graph graphToWriteTo)
                throws IOException
        Reads an entire graph from an 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.
        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
      • readVertex

        Vertex readVertex​(InputStream inputStream,
                          Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Vertex>,​Vertex> vertexAttachMethod)
                   throws IOException
        Reads a single vertex from an 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).
        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 Vertex to a Host object.
        Throws:
        IOException
      • readVertex

        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
        Reads a single vertex from an 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).
        Parameters:
        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.
        Throws:
        IOException
      • readEdge

        Edge readEdge​(InputStream inputStream,
                      Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Edge>,​Edge> edgeAttachMethod)
               throws IOException
        Reads a single edge from an 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).
        Parameters:
        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.
        Throws:
        IOException
      • readProperty

        Property readProperty​(InputStream inputStream,
                              Function<org.apache.tinkerpop.gremlin.structure.util.Attachable<Property>,​Property> propertyAttachMethod)
                       throws IOException
        Reads a single property from an 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).
        Parameters:
        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.
        Returns:
        the value returned by the attach method.
        Throws:
        IOException
      • readObject

        <C> C readObject​(InputStream inputStream,
                         Class<? extends C> clazz)
                  throws IOException
        Reads an arbitrary object using the registered serializers.
        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