prints the characters from the buffer and resets it

TODO: make sure that printBuffer() is called at the end of the stream in case we have some
characters there! (flush() ?)
321522
synchronized void printBuffer() throws IOException { // TODO: is synchronized really needed here?
	int len = sb.length();
	if (len > 0) {
	    char[] chars = new char[len];
	    sb.getChars(0, len, chars, 0);
	    sb.setLength(0);
	    super.write(chars, 0, chars.length);
	}
    }
153725
public void flush() throws IOException {
		if (printWriter != null) {
			printWriter.flush();
		}

		if (gzipOutputStream != null) {
			gzipOutputStream.flush();
		}
	}
887142
private void flushBuffer()
            throws IOException
    {
        if (buffer.position() > 0) {
            buffer.flip();
            writeCompressed(buffer);
            buffer.clear();
        }
    }
800218
public void print(char c) throws IOException
    {
        if(this._listener!= null &&  !checkIfCalledFromWLonError()){
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())    
                Tr.debug(tc, "non blocking print char , WriteListener enabled: " + this._listener);
            this.print_NonBlocking(Character.toString(c));
        }
        else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())    
                Tr.debug(tc, "print char");
            super.print(c);
        }    
    }
488563
public void doing(String str) {
    System.err.print(str);
    System.err.print(" ... ");
    System.err.flush();
    start();
  }
1300180
protected final void flushBuffer() throws IOException {
        if (bufferSize == 0)
            return;
        flushed = true;
        // defect 312981 begin
        //ensureOpen();
    	if (closed) {
    	    throw new IOException("Stream closed");
        }
        // defect 312981 end

        if (nextChar == 0) {
            //PK90190 - start 
            //add check for property to create the writer even when the buffer is empty
            if (WCCustomProperties.GET_WRITER_ON_EMPTY_BUFFER) {
                initOut();
            }
            //PK90190 - end
            return;
        }
        initOut();
        out.write(cb, 0, nextChar);
        nextChar = 0;
    }
1319800
void flush(OutputStream out, String encoding)
         throws IOException
    {
        flush(new OutputStreamWriter(out,encoding));
    }
183055
def __flush_buffer(self):
        
        self.__flush_data(self._buffer.getvalue())
        self._buffer.close()
        self._buffer = StringIO()
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);
    }
  }
758723
public void flush() {
    if(inline.length() > 0) {
      outStream.println(inline);
    }
    inline.setLength(0);
    if(comment.length() > 0) {
      quotePrintln(outStream, comment.toString());
    }
    comment.setLength(0);
  }
702292
@Override
    public void dump(OutputStream output) {
        try (PrintWriter out = new PrintWriter(new OutputStreamWriter(output, UTF_8))) {
            for (long value : values) {
                out.printf("%d%n", value);
            }
        }
    }
949114
public void println(final String str) throws IOException {
        this.writer.print(str);
        this.writer.print("\r\n");
        this.writer.flush();
    }
1107553
private void resetEventBuffer() {
        if (buffer.get() == null) {
            buffer.set(new Holder<>(getOrCreateManager().create(charset.get())));
        } else {
            buffer.get().reset();
        }
    }
724064
private void buffer() throws IOException {
        int remaining = buffer.length;
        while (remaining > 0) {
            int r = input.read(buffer, buffer.length - remaining, remaining);
            if (r <= 0) {
                // Not enough information to fill the buffer
                offset = 0;
                maxOffset = buffer.length - remaining;
                return;
            }
            remaining -= r;
        }
        maxOffset = buffer.length;
        offset = 0;
    }
772339
public void flushBuffer()
        throws IOException
    {
        if (((HttpOutputStream)_httpResponse.getOutputStream()).isClosed())
            return;
        
        if (_writer!=null)
            _writer.flush();
        if (_out!=null)
            _out.flush();
        if (_writer==null && _out==null)
            _httpResponse.getOutputStream().flush();
        if (!_httpResponse.isCommitted())
            _httpResponse.commit();
    }
1279735
private void readChar() throws IOException {
        if ('\n' == lastChar)
        {
            this.colNo = 0;
            this.lineNo++;
        }

        lastChar = reader.read();
        if (-1 == lastChar) return ;

        colNo++;
    }
184594
@Override
    public void flush() {
        if (isStarted) {
            flushBuffer();
            //To avoid memory leaks...
            Arrays.fill(buffer, null);
            isStarted = false;
        }
    }