@Override
    public void write(final NullWritable key, final VertexWritable vertex) throws IOException {
        if (null != vertex) {
            if (this.hasEdges)
                gryoWriter.writeVertex(this.outputStream, vertex.get(), Direction.BOTH);
            else
                gryoWriter.writeVertex(this.outputStream, vertex.get());
        }
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
hadoop-gremlin/src/main/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/gryo/GryoRecordWriter.java