@Override
    public boolean nextKeyValue() throws IOException {
        while(this.lineRecordReader.nextKeyValue()) {
            try (InputStream in = new ByteArrayInputStream(this.lineRecordReader.getCurrentValue().getBytes())) {
                Vertex vertex = this.hasEdges ?
                        this.graphsonReader.readVertex(in, Attachable::get, Attachable::get, Direction.BOTH) :
                        this.graphsonReader.readVertex(in, Attachable::get);
                this.vertexWritable.set(vertex);
                if (graphFilter == null) {
                    return true;
                } else {
                    final Optional<StarGraph.StarVertex> vertexWritable = this.vertexWritable.get().applyGraphFilter(graphFilter);
                    if (vertexWritable.isPresent()) {
                        this.vertexWritable.set(vertexWritable.get());
                        return true;
                    }
                }
            }
        }
        return false;
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/graphson/GraphSONRecordReader.java