package com.tinkerpop.gremlin.structure.io.kryo;

import java.io.ByteArrayOutputStream;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.util.LinkedList;
import java.util.List;

/**
 * @author Stephen Mallette (http://stephen.genoprime.com)
 */
public class VertexByteArrayInputStream extends FilterInputStream {

    private static final byte[] vertexTerminatorClass = new byte[]{15, 1, 1, 9};
    private static final byte[] pattern = ByteBuffer.allocate(vertexTerminatorClass.length + 8).put(vertexTerminatorClass).putLong(4185403236219066774L).array();


    public VertexByteArrayInputStream(final InputStream inputStream) {
        super(inputStream);
    }

    public ByteArrayOutputStream readVertexBytes() throws IOException {
        final ByteArrayOutputStream stream = new ByteArrayOutputStream();
        final LinkedList<Byte> buffer = new LinkedList<>();

        int current = read();
        while (current > -1 && (buffer.size() < 12 || !isMatch(buffer))) {
            stream.write(current);

            current = read();
            if (buffer.size() > 11)
                buffer.removeFirst();

            buffer.addLast((byte) current);
        }

        return stream;
    }

    private static boolean isMatch(final List<Byte> input) {
        for (int i = 0; i < pattern.length; i++) {
            if (pattern[i] != input.get(i)) {
                return false;
            }
        }
        return true;
    }
}

@@ -256,16 +256,224 @@
 t;%0A%0A/**%0A
+ * An %7B@link InputStream%7D implementation that can independently process a Gremlin Kryo file written with%0A * %7B@link KryoWriter#writeVertices(java.io.OutputStream, com.tinkerpop.gremlin.process.Traversal)%7D.%0A *%0A
  * @auth
@@ -523,16 +523,16 @@
 me.com)%0A
-
  */%0Apubl
@@ -840,17 +840,16 @@
 ray();%0A%0A
-%0A
     publ
@@ -942,24 +942,266 @@
 am);%0A    %7D%0A%0A
+    /**%0A     * Read the bytes of the next %7B@link com.tinkerpop.gremlin.structure.Vertex%7D in the stream. The returned%0A     * stream can then be passed to %7B@link KryoReader#readVertex(java.io.InputStream, java.util.function.Function)%7D.%0A     */%0A
     public B

Add more javadoc.