1 16 17 package org.apache.axis.transport.http; 18 19 import javax.servlet.http.HttpServletResponse ; 20 import java.io.IOException ; 21 import java.io.OutputStream ; 22 import java.io.PrintWriter ; 23 24 33 34 public class FilterPrintWriter extends PrintWriter { 35 36 private PrintWriter _writer = null; 37 private HttpServletResponse _response = null; 38 private static OutputStream _sink = new NullOutputStream(); 39 40 public FilterPrintWriter(HttpServletResponse aResponse) { 41 super(_sink); 42 _response = aResponse; 43 } 44 45 private PrintWriter getPrintWriter() { 46 if (_writer == null) { 47 try { 48 _writer = _response.getWriter(); 49 } catch (IOException e) { 50 throw new RuntimeException (e.toString()); 51 } 52 } 53 return _writer; 54 } 55 56 public void write(int i) { 57 getPrintWriter().write(i); 58 } 59 60 public void write(char[] chars) { 61 getPrintWriter().write(chars); 62 } 63 64 public void write(char[] chars, int i, int i1) { 65 getPrintWriter().write(chars, i, i1); 66 } 67 68 public void write(String string) { 69 getPrintWriter().write(string); 70 } 71 72 public void write(String string, int i, int i1) { 73 getPrintWriter().write(string, i, i1); 74 } 75 76 public void flush() { 77 getPrintWriter().flush(); 78 } 79 80 public void close() { 81 getPrintWriter().close(); 82 } 83 84 public boolean checkError() { 85 return getPrintWriter().checkError(); 86 } 87 88 public void print(boolean b) { 89 getPrintWriter().print(b); 90 } 91 92 public void print(char c) { 93 getPrintWriter().print(c); 94 } 95 96 public void print(int i) { 97 getPrintWriter().print(i); 98 } 99 100 public void print(long l) { 101 getPrintWriter().print(l); 102 } 103 104 public void print(float v) { 105 getPrintWriter().print(v); 106 } 107 108 public void print(double v) { 109 getPrintWriter().print(v); 110 } 111 112 public void print(char[] chars) { 113 getPrintWriter().print(chars); 114 } 115 116 public void print(String string) { 117 getPrintWriter().print(string); 118 } 119 120 public void print(Object object) { 121 getPrintWriter().print(object); 122 } 123 124 public void println() { 125 getPrintWriter().println(); 126 } 127 128 public void println(boolean b) { 129 getPrintWriter().println(b); 130 } 131 132 public void println(char c) { 133 getPrintWriter().println(c); 134 } 135 136 public void println(int i) { 137 getPrintWriter().println(i); 138 } 139 140 public void println(long l) { 141 getPrintWriter().println(l); 142 } 143 144 public void println(float v) { 145 getPrintWriter().println(v); 146 } 147 148 public void println(double v) { 149 getPrintWriter().println(v); 150 } 151 152 public void println(char[] chars) { 153 getPrintWriter().println(chars); 154 } 155 156 public void println(String string) { 157 getPrintWriter().println(string); 158 } 159 160 public void println(Object object) { 161 getPrintWriter().println(object); 162 } 163 164 static public class NullOutputStream extends OutputStream { 165 public void write(int b) { 166 } 168 } 169 } 170 | Popular Tags |