code: @Override
      public void flush() {
          Exceptions.checkNotClosed(this.closed, this);
          if (!this.hasDataInCurrentFrame) {
              // Nothing to do.
              return;
          }
  
          // Seal the current frame for appends.
          this.currentFrame.seal();
  
          // Invoke the callback. At the end of this, the frame is committed so we can get rid of it.
          if (!this.currentFrame.isEmpty()) {
              // Only flush something if it's not empty.
              this.bufferFactory.markUsed(this.currentFrame.getLength());
              this.dataFrameCompleteCallback.accept(this.currentFrame);
          }
  
          reset();
      }
docs: Seals the current frame (if any), and invokes the dataFrameCompleteCallback with the finished frame.
  If the dataFrameCompleteCallback failed (and threw an exception), the current frame will be sealed and therefore
  the DataFrameOutputStream may not be usable.