Flush the sniffer buffer and append the information about the executed queries to the output stream
@throws IOException
194864
protected void flushIfPossible() throws IOException {

        // TODO: do not flush if wasn't requested by underlying application
        if (null != bufferedServletOutputStream) bufferedServletOutputStream.setLastChunk();

        if (null != writer) writer.flushIfOpen();
        else if (null != outputStream) outputStream.flushIfOpen();
        else {
            if (!isCommitted()) {
                notifyBeforeCommit();
            }
            notifyBeforeClose();
        }
    }
164165
@FFDCIgnore({ IOException.class })
    private void flushUpgradedOutputBuffers() throws IOException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "flushUpgraded: Flushing buffers for Upgraded output: " + this);
        }
        final boolean writingBody = (hasBufferedContent());
        // flip the last buffer for the write...
        if (writingBody && null != this._output[this.outputIndex]) {
            this._output[this.outputIndex].flip();
        }
        try {
            WsByteBuffer[] content = (writingBody) ? this._output : null;
            // write it out to TCP            
            if(content != null) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "flushUpgraded:: Now write the content ");
                }
                _tcpContext.getWriteInterface().setBuffers(content);
                _tcpContext.getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, WCCustomProperties31.UPGRADE_WRITE_TIMEOUT);
            }
            else{
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "flushUpgraded: No more data to flush ");
                } 
            }

        } catch (IOException ioe) {
            this.error = ioe;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "flushUpgraded: Received exception during write: " + ioe);
            }
            throw ioe;
        } finally {
            this.bytesWritten += this.bufferedCount;            
            this.bufferedCount = 0;
            this.outputIndex = 0;
            // Note: this logic only works for sync writes
            if (writingBody) {
                if (null != this._output){
                    if (null != this._output[0]) {
                        this._output[0].clear();
                    }
                    for (int i = 1; i < this._output.length; i++) {
                        if (null != this._output[i]) {
                            // mark them empty so later writes don't mistake them
                            // as having content
                            this._output[i].position(0);
                            this._output[i].limit(0);
                        }
                    }
                }
            }
            // disconnect write buffers in TCP when done
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "flushUpgraded: disconnect write buffers in TCP when done");
            }
            _tcpContext.getWriteInterface().setBuffers(null);
        }
    }
1250007
public void flushResponse() throws IOException {
        try {
            // Finish GZIP encodig
            if (gzipOut != null) {
                gzipOut.finish();
            }

            flushBuffer();
        }
        finally {
            // Close stream
            if (writer != null) {
                writer.close();
            }
            else {
                if (out != null) {
                    out.close();
                }
            }
        }
    }
17426
@SuppressWarnings("nls")
	public void flush()
	{
		synchronized (this)
		{
			// write xml header
			if (!hasXmlHeader)
			{
				out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?> ");
				out.println("<java version=\"" + System.getProperty("java.version") + "\" class=\"com.googlecode.openbeans.XMLDecoder\"> ");
				hasXmlHeader = true;
			}

			// preprocess pending objects
			for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();)
			{
				Object o = iter.next();
				Record rec = objRecordMap.get(o);
				if (rec != null)
				{
					preprocess(o, rec);
				}
			}

			// flush pending objects
			for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();)
			{
				Object o = iter.next();
				flushObject(o, INDENT_UNIT);
				// remove flushed obj
				iter.remove();
			}

			// clear statement records
			objRecordMap.clear();
			flushPendingStat.clear();
			objPrePendingCache.clear();
			clazzCounterMap.clear();

			// remove all old->new mappings
			super.clear();
		}
	}
184594
@Override
    public void flush() {
        if (isStarted) {
            flushBuffer();
            //To avoid memory leaks...
            Arrays.fill(buffer, null);
            isStarted = false;
        }
    }
1301846
private void flushBuffer() throws IOException {
    if (this.dirty_) {
      if (this.diskPos_ != this.lo_) {
        super.seek(this.lo_);
      }
      int len = (int) (this.curr_ - this.lo_);
      super.write(this.buff_, 0, len);
      this.diskPos_ = this.curr_;
      this.dirty_ = false;
    }
  }
1185903
@Override
    public void flush() throws IOException
    {
        if (deflater != null)
        {
            writeTrailer();
        }
        else
        {
            if (inflater != null)
            {
                if (inflater.finished() && !trailerRead)
                {
                    ByteBuffer bb = ByteBuffer.allocate(bufSize);
                    int rc = read(bb);
                    while (rc != -1)
                    {
                        bb.clear();
                        rc = read(bb);
                    }
                }
            }
        }
    }
1303622
public void flushBuffer()
  {
    Writer out = this.out;
    if (out == null)
      return;

    try {
      if (out instanceof FlushBuffer)
        ((FlushBuffer) out).flushBuffer();
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }
  }
723735
@Override
  public void flush()
    throws IOException
  {
    OutputStream stream = getStream();

    if (stream == null) {
      return;
    }

    synchronized (stream) {
      stream.flush();
    }
  }
767635
public function flush()
    {
        foreach ($this->buffer as $data) {
            $this->output->write($data['messages'], $data['newline'], $data['options']);
        }

        // Clear the buffer array.
        $this->buffer = [];
    }
843867
public void flush() throws IOException {
        checkForClosed();
        writeBufferToFile();
        if (_currentOffset > _offset) { // something to commit
            _nfsFile.commit(_offset, (int) (_currentOffset - _offset));
            _offset = _currentOffset;
        }
        super.flush();
    }
1264279
public void flush() throws IOException
  {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
      {
        Tr.debug(tc, "flush");
      }
      this.output.flush();
  }
910393
public void flush() throws IOException {
        final ByteOutput output = this.output;
        final int pos = this.position;
        if (pos > 0) {
            output.write(CHUNK_START);
            writeInt(pos);
            final byte[] buffer = this.buffer;
            output.write(buffer, 0, pos);
        }
        this.position = 0;
    }
297205
public void flush() throws IOException {
        if (unflushed.get() == 0) return;

        synchronized (lock) {
            if (logger.isTraceEnabled()) {
                logger.debug("Flushing log '" + name + "' last flushed: " + getLastFlushedTime() + " current time: " + System
                        .currentTimeMillis());
            }
            segments.getLastView().getMessageSet().flush();
            unflushed.set(0);
            lastflushedTime.set(System.currentTimeMillis());
        }
    }
375490
public final void flush() throws IOException
    {
        if (! _closed)
        {
            if (atDatagramLevel() && ! hasAnnotations())
            {
                SymbolTable symtab = getSymbolTable();

                if (symtab != null &&
                    symtab.isReadOnly() &&
                    symtab.isLocalTable())
                {
                    // It's no longer possible to add more symbols to the local
                    // symtab, so we can safely write everything out.
                    writeAllBufferedData();
                }
            }

            _user_output_stream.flush();
        }
    }
1059093
@Override
    public void flush() throws IOException
    {
        if ( buf != null && buf.position() > 0 )
        {    
            buf.flip();
            rwChannel.write( buf );
            buf.clear();
        }
    }
63319
@Override
    public void flush() {

        PrintWriter out = null;
        try {
            try {
                out = new PrintWriter(Utils.createFile(dir, file), "UTF-8");
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            String contents = getBuffer().toString();
            out.write(processor.apply(contents));
        } finally {
            closeQuietly(out);
        }
    }