src/main/java/org/jcodec/containers/flv/FLVReader.java
public boolean repositionFile() throws IOException {
        int payloadSize = 0;
        for (int i = 0; i < REPOSITION_BUFFER_READS; i++) {
            while (readBuf.hasRemaining()) {
                payloadSize = ((payloadSize & 0xffff) << 8) | (readBuf.get() & 0xff);
                int pointerPos = readBuf.position() + 7 + payloadSize;
                if (readBuf.position() >= 8 && pointerPos < readBuf.limit() - 4
                        && readBuf.getInt(pointerPos) - payloadSize == 11) {
                    readBuf.position(readBuf.position() - 8);
                    return true;
                }
            }
            initialRead(ch);
            if (!readBuf.hasRemaining())
                break;
        }
        return false;
    }
public boolean repositionFile() throws IOException {
        int payloadSize = 0;
        for (int i = 0; i < REPOSITION_BUFFER_READS; i++) {
            while (readBuf.hasRemaining()) {
                payloadSize = ((payloadSize & 0xffff) << 8) | (readBuf.get() & 0xff);
                int pointerPos = readBuf.position() + 7 + payloadSize;
                if (readBuf.position() >= 8 && pointerPos < readBuf.limit() - 4
                        && readBuf.getInt(pointerPos) - payloadSize == 11) {
                    readBuf.position(readBuf.position() - 8);
                    return true;
                }
            }
            initialRead(ch);
            if (!readBuf.hasRemaining())
                break;
        }
        return false;
    }
Searching for the next tag in a file after corrupt segment

@return
@throws IOException