docs: private boolean performFlushIfRequired() throws IOException {
          if (anyAreSet(state, FLUSHING_BUFFER)) {
              final ByteBuffer[] bufs = new ByteBuffer[additionalBuffer == null ? 1 : 2];
              long totalLength = 0;
              bufs[0] = currentBuffer.getBuffer();
              totalLength += bufs[0].remaining();
              if (additionalBuffer != null) {
                  bufs[1] = additionalBuffer;
                  totalLength += bufs[1].remaining();
              }
              if (totalLength > 0) {
                  long total = 0;
                  long res = 0;
                  do {
                      res = next.write(bufs, 0, bufs.length);
                      total += res;
                      if (res == 0) {
                          return false;
                      }
                  } while (total < totalLength);
              }
              additionalBuffer = null;
              currentBuffer.getBuffer().clear();
              state = state & ~FLUSHING_BUFFER;
          }
          return true;
      }