@Override public void print(char c) throws IOException {
  boolean isWS=Character.isWhitespace(c);
  if (isWS) {
    if (isFirstChar)     return;
    if (c == CHAR_RETURN)     return;
    if (sb.length() > 0) {
      printBuffer();
      lastChar=(c == CHAR_NL) ? CHAR_NL : c;
      super.print(lastChar);
      return;
    }
  }
  isFirstChar=false;
  if (c == CHAR_GT && sb.length() > 0)   printBuffer();
  if (isWS || !addToBuffer(c)) {
    if (depthSum == 0) {
      if (isWS) {
        if (lastChar == CHAR_NL)         return;
        if (c != CHAR_NL) {
          if (Character.isWhitespace(lastChar))           return;
        }
      }
    }
    lastChar=c;
    super.print(c);
  }
}

@ Override public void print ( char c ) throws IOException { boolean isWS = Character . isWhitespace ( c ) ; if ( isWS ) { if ( isFirstChar ) return ; if ( c == CHAR_RETURN ) return ; if ( sb . length ( ) > 0 ) { printBuffer ( ) ; lastChar = ( c == CHAR_NL ) ? CHAR_NL : c ; super . print ( lastChar ) ; return ; } } isFirstChar = false ; if ( c == CHAR_GT && sb . length ( ) > 0 ) printBuffer ( ) ; if ( isWS || ! addToBuffer ( c ) ) { if ( depthSum == 0 ) { if ( isWS ) { if ( lastChar == CHAR_NL ) return ; if ( c != CHAR_NL ) { if ( Character . isWhitespace ( lastChar ) ) return ; } } } lastChar = c ; super . print ( c ) ; } }
sends a character to output stream if it is not a consecutive white - space unless we ' re inside a pre or textarea tag .
