1 7 package com.inversoft.junit.internal.http; 8 9 import java.io.IOException ; 10 11 import javax.servlet.jsp.JspWriter ; 12 13 22 public class MockJspWriter extends JspWriter { 23 24 private StringBuffer buf; 25 26 27 30 public MockJspWriter(int length, boolean autoFlush) { 31 super(length, autoFlush); 32 buf = new StringBuffer (); 33 } 34 35 36 public void print(String a) { 37 buf.append(a); 38 } 39 40 public void print(boolean a) { 41 buf.append(a); 42 } 43 44 public void print(float a) { 45 buf.append(a); 46 } 47 48 public void print(char a) { 49 buf.append(a); 50 } 51 52 public void print(int a) { 53 buf.append(a); 54 } 55 56 public void println(String a) { 57 buf.append(a); 58 } 59 60 public void print(double a) { 61 buf.append(a); 62 } 63 64 public void print(long a) { 65 buf.append(a); 66 } 67 68 public void print(char[] a) { 69 buf.append(a); 70 } 71 72 public void print(Object a) { 73 buf.append(a); 74 } 75 76 public void println() { 77 buf.append("\n"); 78 } 79 80 public void println(boolean a) { 81 buf.append(a).append("\n"); 82 } 83 84 public void println(char a) { 85 buf.append(a).append("\n"); 86 } 87 88 public void println(int a) { 89 buf.append(a).append("\n"); 90 } 91 92 public void println(float a) { 93 buf.append(a).append("\n"); 94 } 95 96 public void println(double a) { 97 buf.append(a).append("\n"); 98 } 99 100 public void println(long a) { 101 buf.append(a).append("\n"); 102 } 103 104 public void println(char[] a) { 105 buf.append(a).append("\n"); 106 } 107 108 public void println(Object a) { 109 buf.append(a).append("\n"); 110 } 111 112 public void write(int a) { 113 buf.append(a + "\n"); 114 } 115 116 public void write(byte[] a) { 117 buf.append(new String (a)); 118 } 119 120 public void write(byte[] a, int b, int c) { 121 buf.append(new String (a, b, c)); 122 } 123 124 public void write(char[] cbuf, int off, int len) { 125 buf.append(new String (cbuf, off, len)); 126 } 127 128 public void newLine() throws IOException { 129 buf.append("\n"); 130 } 131 132 public int getRemaining() { 133 return getBufferSize() - buf.length(); 134 } 135 136 public void clear() { 137 buf.delete(0, buf.length()); 138 } 139 140 public void clearBuffer() { 141 buf.delete(0, buf.length()); 142 } 143 144 public void flush() { 145 } 147 148 public void close() { 149 } 151 152 public String getText() { 153 return buf.toString(); 154 } 155 } | Popular Tags |