code: private void writeChecksumChunk(byte b[], int off, int len, boolean keep)
    throws IOException {
      int tempChecksum = (int)sum.getValue();
      if (!keep) {
        sum.reset();
      }
      int2byte(tempChecksum, checksum);
      writeChunk(b, off, len, checksum);
    }
docs: Generate checksum for the data chunk and output data chunk & checksum
  to the underlying output stream. If keep is true then keep the
  current checksum intact, do not reset it.