5 * LineFilterWriter eliminates superfluous \t \r \n and spaces
6 * and thus compresses the output of html
9 public final class LineFilterWriter extends PrintWriter{
13 public LineFilterWriter(Writer out) {
18 public final void write(String str){
23 if (len==1) {try{out.write(str);}catch(IOException e){}return;}
24 StringBuffer sbuf = new StringBuffer();
29 j = str.indexOf('\n',i);
31 sbuf.append(str.substring(i,j+1));
36 if (!Character.isWhitespace(c)) {
41 try{out.write(sbuf.toString());}catch(IOException e){;}
44 public final void write(char[] cbuf, int off,int len){
49 for(i=off;i<len;i++) {
52 if (c=='\n') state=false;
56 if (!Character.isWhitespace(c)) {
61 try{out.write(cbuf,off,j);}catch(IOException e){;}