1 23 24 package org.enhydra.xml.xmlc.servlet; 25 26 import java.io.IOException ; 27 import java.io.Writer ; 28 29 import javax.servlet.ServletContext ; 30 31 35 class ServletLogWriter extends Writer { 36 39 private ServletContext fServletContext; 40 41 44 private StringBuffer fBuf = new StringBuffer (); 45 46 49 public ServletLogWriter(ServletContext servletContext) { 50 fServletContext = servletContext; 51 } 52 53 56 public void close() throws IOException { 57 flush(); 58 } 59 60 63 public void flush() throws IOException { 64 if (fBuf.length() > 0) { 65 fServletContext.log(fBuf.toString()); 66 fBuf.setLength(0); 67 } 68 } 69 70 73 public void write(char[] cbuf, 74 int off, 75 int len) throws IOException { 76 fBuf.append(cbuf, off, len); 77 } 78 } 79 | Popular Tags |