code: public void flush() throws IOException {
          if(closed) {
              throw new IllegalStateException("Can't flush packets on a closed stream!");
          }
  
          // Write in one go
          OggPage[] pages = buffer.toArray(new OggPage[buffer.size()]); 
          file.writePages(pages);
  
          // Get ready for next time!
          buffer.clear();
      }
docs: Writes all pending packets to the stream,
  splitting across pages as needed.