code: private void readContents(int maxFrames) {
          // Read GIF file content blocks.
          boolean done = false;
          while (!(done || err() || header.frameCount > maxFrames)) {
              int code = read();
              switch (code) {
                  // Image separator.
                  case 0x2C:
                      // The graphics control extension is optional, but will always come first if it exists.
                      // If one did
                      // exist, there will be a non-null current frame which we should use. However if one
                      // did not exist,
                      // the current frame will be null and we must create it here. See issue #134.
                      if (header.currentFrame == null) {
                          header.currentFrame = new GifFrame();
                      }
                      readBitmap();
                      break;
                  // Extension.
                  case 0x21:
                      code = read();
                      switch (code) {
                          // Graphics control extension.
                          case 0xf9:
                              // Start a new frame.
                              header.currentFrame = new GifFrame();
                              readGraphicControlExt();
                              break;
                          // Application extension.
                          case 0xff:
                              readBlock();
                              String app = "";
                              for (int i = 0; i < 11; i++) {
                                  app += (char) block[i];
                              }
                              if (app.equals("NETSCAPE2.0")) {
                                  readNetscapeExt();
                              } else {
                                  // Don't care.
                                  skip();
                              }
                              break;
                          // Comment extension.
                          case 0xfe:
                              skip();
                              break;
                          // Plain text extension.
                          case 0x01:
                              skip();
                              break;
                          // Uninteresting extension.
                          default:
                              skip();
                      }
                      break;
                  // Terminator.
                  case 0x3b:
                      done = true;
                      break;
                  // Bad byte, but keep going and see what happens break;
                  case 0x00:
                  default:
                      header.status = GifDecoder.STATUS_FORMAT_ERROR;
              }
          }
      }
docs: Main file parser. Reads GIF content blocks. Stops after reading maxFrames