public static boolean searchQuad(final int quad, final InputStream in) throws IOException {
        final byte[] needle = quadsToByteArray(quad);
        int b = -1;
        int position = 0;
        while ((b = in.read()) != -1) {
            if (needle[position] == b) {
                position++;
                if (position == needle.length) {
                    return true;
                }
            } else {
                position = 0;
            }
        }
        return false;
    }
Consumes the {@code InputStream} (without closing it) searching for a quad. It will stop either when the quad is found, or when there are no more bytes
in the input stream.

<p>
Returns {@code true} if it found the quad, and {@code false} otherwise.

@param quad a quad (the needle)
@param in  an input stream (the haystack)
@return {@code true} if it found the quad, and {@code false} otherwise
@throws IOException if it fails to read from the given input stream
src/main/java/org/apache/commons/imaging/common/BinaryFunctions.java