docs: private static int readHeaderFromStream(
        int maxHeaderLength,
        final InputStream is,
        final byte[] imageHeaderBytes)
        throws IOException {
      Preconditions.checkNotNull(is);
      Preconditions.checkNotNull(imageHeaderBytes);
      Preconditions.checkArgument(imageHeaderBytes.length >= maxHeaderLength);
  
      // If mark is supported by the stream, use it to let the owner of the stream re-read the same
      // data. Otherwise, just consume some data.
      if (is.markSupported()) {
        try {
          is.mark(maxHeaderLength);
          return ByteStreams.read(is, imageHeaderBytes, 0, maxHeaderLength);
        } finally {
          is.reset();
        }
      } else {
        return ByteStreams.read(is, imageHeaderBytes, 0, maxHeaderLength);
      }
    }