@Override
    protected Path readValue(final Buffer buffer, final GraphBinaryReader context) throws IOException {
        final MutablePath path = (MutablePath) MutablePath.make();
        final List<Set<String>> labels = context.read(buffer);
        final List<Object> objects = context.read(buffer);

        if (labels.size() != objects.size())
            throw new IllegalStateException("Format for Path object requires that the labels and objects fields be of the same length");

        for (int ix = 0; ix < labels.size(); ix++) {
            path.extend(objects.get(ix), labels.get(ix));
        }

        return ReferenceFactory.detach(path);
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/binary/types/PathSerializer.java