code: protected synchronized void flushBuffer(boolean chunkComplete,
        boolean keepPartialData) throws IOException {
      if (count != 0) {
        int chunkLen = count;
        count = 0;
        writeChecksumChunk(buf, 0, chunkLen, keepPartialData && !chunkComplete);
        if (!chunkComplete) {
          if (!keepPartialData) {
            bytesSentInChunk += chunkLen;
          } else {
            count = chunkLen;
          }
        } else {
          bytesSentInChunk = 0;
        }
      }
    }
docs: /* Forces any buffered output bytes to be checksumed and written out to
  the underlying output stream.  If keep is true, then the state of
  this object remains intact.