private static VertexWritable byteClone(final VertexWritable vertexWritable) {
        try {
            final VertexWritable clone = new VertexWritable();
            final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            vertexWritable.write(new DataOutputStream(outputStream));
            outputStream.flush();
            clone.readFields(new DataInputStream(new ByteArrayInputStream(outputStream.toByteArray())));
            return clone;
        } catch (final Exception e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
@author Marko A. Rodriguez (http://markorodriguez.com)
hadoop-gremlin/src/test/java/org/apache/tinkerpop/gremlin/hadoop/structure/io/VertexWritableTest.java