Flush the output array of buffers to the network below.

@throws IOException
335740
private void flushAsyncUpgradedOutputBuffers() throws IOException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "flushAsyncUpgraded: Flushing async 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();
        }
        VirtualConnection _vcWrite = null;
        try {
            WsByteBuffer[] content = (writingBody) ? this._output : null;
            // write it out to TCP           
            if(content != null) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "flushAsyncUpgraded: Now write it out to TCP");
                }
                _tcpContext.getWriteInterface().setBuffers(content);

                _vcWrite =_tcpContext.getWriteInterface().write(TCPWriteRequestContext.WRITE_ALL_DATA, _callback, false, WCCustomProperties31.UPGRADE_WRITE_TIMEOUT);
                if (_vcWrite == null) { // then we will have to wait for data to be written, async write in progress                                        
                    this.setInternalReady(false); // tell internal
                    this.setReadyForApp(false); // tell app
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "flushAsyncUpgraded:  wait for data to be written, async write in progress, set ready to false");
                    }
                }
            }
            else{
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "flushAsyncUpgraded: No more data to flush ");
                } 
            }        
        } finally {
            this.bytesWritten += this.bufferedCount;            
            this.bufferedCount = 0;
            this.outputIndex = 0;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "flushAsyncUpgraded: finally, this " + this + " , bytesWritten -->" + this.bytesWritten);
            }
            if (writingBody && _vcWrite != null) {
                clearBuffersAfterWrite();
            }
        }
    }
1053685
protected void flush() throws IOException {
		if (this.tempStream != null && this.buffer.position() > 0) {
			final int pos = this.buffer.position();
			this.buffer.rewind();
			this.buffer.limit(pos);

			this.tempStream.write(this.buffer);

			this.buffer.rewind();
			this.buffer.limit(this.buffer.capacity());

			this.bufferPosition += pos;
		}
	}
1222007
public List<String> flushStdout() throws IOException {
		List<String> result = new ArrayList<String>();
		while(stdout.ready()) {
			result.add(stdout.readLine());
		}
		return result;
	}
232970
protected void flushBuffer() throws IOException {
		if (capacity == 0) {
			ostream.write(buffer);
			capacity = BITS_IN_BYTE;
			buffer = 0;
			len++;
		}
	}
1140774
@FFDCIgnore({ IOException.class })
    private void flushAsyncBuffers() throws IOException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Flushing Async buffers: " + this);
        }
        if (!this.isc.getResponse().isCommitted()) {
            if ((obs != null) && !this.WCheadersWritten) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "obs  ->" + obs);
                }
                obs.alertOSFirstFlush();
            }

            this.isc.getResponse().setCommitted();
        }

        if (this.ignoreFlush) {
            this.ignoreFlush = false;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Ignoring first flush attempt");
            }
            return;
        }

        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;
            if (isClosed() || this.isClosing) {
                if (!hasFinished) { //if we've already called finishResponseMessage - don't call again
                    // on a closed stream, use the final write api
                    this.isc.finishResponseMessage(content); // check if this also needs to be async
                    this.isClosing = false;
                    this.hasFinished = true;
                }
            } else {
                // else use the partial body api
                // Add the async option.               
                vc = this.isc.sendResponseBody(content, _callback, false);
                if (vc == null) { // then we will have to wait for data to be written, async write in progress
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "wait for data to be written, async write in progress, set ready to false");
                    }
                    synchronized (this._writeReadyLockObj) {
                        this.setWriteReady(false);
                        this.set_internalReady(false);
                    }
                }
                else {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "able to write out, no callback required, vc -->" + vc);
                    }
                }
            }
        } catch (MessageSentException mse) {
            FFDCFilter.processException(mse, getClass().getName(),
                                        "flushAsyncBuffers", new Object[] { this, this.isc });
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Invalid state, message-sent-exception received; " + this.isc);
            }
            this.error = new IOException("Invalid state");
            throw this.error;
        } catch (IOException ioe) {
            // no FFDC required
            this.error = ioe;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Received exception during write: " + ioe);
            }
            throw ioe;
        } finally {
            this.bytesWritten += this.bufferedCount;
            if (this.contentLengthSet) {
                this.bytesRemaining -= this.bufferedCount;
            }
            this.bufferedCount = 0;
            this.outputIndex = 0;
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "finally, this " + this + " ,bytesRemaining -->" + this.bytesRemaining + ", bytesWritten -->" + this.bytesWritten);
            }
            if (writingBody && vc != null) {
                clearBuffersAfterWrite();
            }
        }
    }
137196
private void flushCharactersBuffer() throws IOException
  {
    if(charactersBuffer.position() > 0) {
      writer.write(charactersBuffer.array(), 0, charactersBuffer.position());
      charactersBuffer.rewind();
    }
  }
71713
public void flushTo(OutputStream out) throws IOException {
		int n1 = _flushPosition / _bufferSize;
		int n2 = _position / _bufferSize;
		if (n1 < n2) {
			flushTo(Channels.newChannel(out));
		}
	}
605797
public synchronized void flush()
	{
		if (out != null)
			try {
				out.flush();
			}
			catch (final IOException e) {
				getErrorHandler().error(this, "on flush", e);
			}
	}
353046
def _flush(self):
        """"""
        self._buffer.sort()
        self._replace_batch()
        self._buffer = []
        self._compress()
873409
public void flushBuffer()
  {
    try {
      _out.flushBuffer();
    } catch (IOException e) {
      log.log(Level.FINE, e.toString(), e);
    }
  }
393227
private void flushBuffer(final ByteBuffer buffer, final DataOutput stream) throws IOException {
        buffer.flip();
        stream.write(buffer.array(), buffer.arrayOffset(), buffer.remaining());

        buffer.clear();
    }
843867
public void flush() throws IOException {
        checkForClosed();
        writeBufferToFile();
        if (_currentOffset > _offset) { // something to commit
            _nfsFile.commit(_offset, (int) (_currentOffset - _offset));
            _offset = _currentOffset;
        }
        super.flush();
    }
6716
private static void writeAndFlush(
      final ByteBuffer buffer, final OutputStream outputStream) throws IOException {

    if (buffer.hasArray()) {
      outputStream.write(buffer.array(), buffer.position(), buffer.remaining());
    } else {
      // cannot access underlying byte array, need to copy into a temporary array
      while (buffer.hasRemaining()) {
        // figure out how much to read, but use an upper limit of 8kb. LogMessages should be rather
        // small so we don't expect this to get hit but avoid large temporary buffers, just in case.
        final int size = Math.min(buffer.remaining(), 8 * 1024);
        final byte[] chunk = new byte[size];
        buffer.get(chunk);
        outputStream.write(chunk);
      }
    }
    outputStream.flush();
  }
1203632
private void flushBuffer() {
		// Do the actual logging:
		removes.ensureCapacity(buffer.size());
		for(Iterator<LoggingEvent> i = buffer.iterator(); i.hasNext();) {
			try {
				LoggingEvent event = (LoggingEvent)i.next();
				doLog(event);
				removes.add(event);
			} catch(Exception e) {
				errorHandler.error("Failed to flush log", e, ErrorCode.FLUSH_FAILURE);
			}
		}

		// Remove from the buffer any events that were reported:
		buffer.removeAll(removes);

		// Clear the buffer of reported events:
		removes.clear();
	}
178606
private final void flushBuffer() throws IOException {
		if (bufOutput.position() > 0) {
			bufOutput.flip();
			fcOutput.write(bufOutput);
			bufOutput.clear();
			// log.debug("offsetOutputUncommited=" + offsetOutputUncommited + " offsetOutputCommited=" +
			// offsetOutputCommited + " fcOutput.position()=" + fcOutput.position());
			offsetOutputUncommited = offsetOutputCommited = fcOutput.position();
			if (syncOnFlush) {
				fcOutput.force(false);
				if (callback != null) {
					callback.synched(offsetOutputCommited);
				}
			}
		}
	}
1327957
@Override
    public final void flush()
        throws IOException
    {
        _flushBuffer();
        if (_writer != null) {
            if (isEnabled(Feature.FLUSH_PASSED_TO_STREAM)) {
                _writer.flush();
            }
        }
    }
231616
@Override
    public synchronized void flush() throws IOException {
        ensureOpen();
        if (decodedBuf.position() > 0) {
            decodedBuf.flip();
            String contents = decodedBuf.toString();
            String filtered = contentFilter.filter(contents);
            out.write(filtered.getBytes(charset));
            decodedBuf.clear();
        }
        out.flush();
    }