1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.huihoo.jfox.soaf.util.filter;
18
19 import java.io.IOException;
20 import java.io.OutputStream;
21
22 import javax.servlet.ServletOutputStream;
23
24 /***
25 * Delegating implementation of ServletOutputStream.
26 *
27 * <p>Used by MockHttpServletResponse; typically not
28 * directly used for testing application controllers.
29 *
30 * @author Juergen Hoeller
31 * @since 1.0.2
32 * @see MockHttpServletResponse
33 */
34 public class MockServletOutputStream extends ServletOutputStream {
35
36 private final OutputStream targetStream;
37
38 /***
39 * Create a new DelegatingServletOutputStream.
40 * @param targetStream the target OutputStream
41 */
42 public MockServletOutputStream(OutputStream targetStream) {
43 this.targetStream = targetStream;
44 }
45
46 public void write(int b) throws IOException {
47 this.targetStream.write(b);
48 }
49
50 public void flush() throws IOException {
51 super.flush();
52 this.targetStream.flush();
53 }
54
55 public void close() throws IOException {
56 super.close();
57 this.targetStream.close();
58 }
59
60 }