code: private void readHeader() {
          String id = "";
          for (int i = 0; i < 6; i++) {
              id += (char) read();
          }
          if (!id.startsWith("GIF")) {
              header.status = GifDecoder.STATUS_FORMAT_ERROR;
              return;
          }
          readLSD();
          if (header.gctFlag && !err()) {
              header.gct = readColorTable(header.gctSize);
              header.bgColor = header.gct[header.bgIndex];
          }
      }
docs: Reads GIF file header information.