1 package com.opensymphony.webwork.webFlow.model; 2 3 import java.io.IOException ; 4 import java.io.Writer ; 5 6 11 public class IndentWriter extends Writer { 12 Writer writer; 13 14 public IndentWriter(Writer writer) { 15 this.writer = writer; 16 } 17 18 public void close() throws IOException { 19 writer.close(); 20 } 21 22 public void flush() throws IOException { 23 writer.flush(); 24 } 25 26 public void write(String str) throws IOException { 27 write(str, false); 28 } 29 30 public void write(String str, boolean noIndent) throws IOException { 31 if (!noIndent) { 32 str = " " + str; 33 } 34 35 if (writer instanceof IndentWriter) { 36 ((IndentWriter) writer).write(str, false); 37 } else { 38 writer.write(str + "\n"); 39 } 40 } 41 42 public void write(char cbuf[], int off, int len) throws IOException { 43 writer.write(cbuf, off, len); 44 } 45 } 46 | Popular Tags |