code: private void write0(int b) throws IOException {
          if (this.currentChar != -1) {
              b &= 0xff;
              if (this.currentChar == b) {
                  if (++this.runLength > 254) {
                      writeRun();
                      this.currentChar = -1;
                      this.runLength = 0;
                  }
                  // else nothing to do
              } else {
                  writeRun();
                  this.runLength = 1;
                  this.currentChar = b;
              }
          } else {
              this.currentChar = b & 0xff;
              this.runLength++;
          }
      }
docs: Keeps track of the last bytes written and implicitly performs
  run-length encoding as the first step of the bzip2 algorithm.