public int read(InputStream is) {
        init();
        try {
            if (is != null) {
                if (!(is instanceof BufferedInputStream)) {
                    is = new BufferedInputStream(is);
                }
                in = (BufferedInputStream) is;
                readHeader();
                if (!err()) {
                    readContents();
                    if (frameCount < 0) {
                        status = STATUS_FORMAT_ERROR;
                    }
                }
            } else {
                status = STATUS_OPEN_ERROR;
            }
        } finally {
            if (is != null)
                try {
                    is.close();
                } catch (IOException e) {
                }
        }
        return status;
    }
Reads GIF image from stream

@param is containing GIF file.
@return read status code (0 = no errors)
plugins/base-plugin/src/main/java/com/github/hui/quick/plugin/base/gif/GifDecoder.java