synchronized void printBuffer() throws IOException {
  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);
  }
}

synchronized void printBuffer ( ) throws IOException { 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 ) ; } }
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 ( ) ? )
