OSDN Git Service

ユニットテスト下請け修正
[mikutoga/Pmd2XML.git] / src / test / java / testdata / DebugOutputStream.java
1 /*
2  */
3
4 package testdata;
5
6 import java.io.IOException;
7 import java.io.OutputStream;
8
9 /**
10  * デバッガ監視用出力ストリーム。
11  */
12 public class DebugOutputStream extends OutputStream{
13
14     private final OutputStream os;
15     private long dumpedBytes = 0L;
16
17
18     /**
19      * コンストラクタ。
20      * @param os 委譲先出力ストリーム
21      */
22     public DebugOutputStream(OutputStream os){
23         super();
24         this.os = os;
25         return;
26     }
27
28
29     /**
30      * デバッガ用監視場所。
31      */
32     private void before(){
33         assert true;
34         return;
35     }
36
37     /**
38      * デバッガ用監視場所。
39      */
40     private void after(){
41         assert true;
42         this.dumpedBytes++;
43         return;
44     }
45
46     /**
47      * {@inheritDoc}
48      * @param b {@inheritDoc}
49      * @throws IOException {@inheritDoc}
50      */
51     @Override
52     public void write(int b) throws IOException {
53         before();
54
55         this.os.write(b);
56
57         after();
58
59         return;
60     }
61
62     /**
63      * {@inheritDoc}
64      * @throws IOException {@inheritDoc}
65      */
66     @Override
67     public void close() throws IOException {
68         this.os.close();
69         return;
70     }
71
72     /**
73      * {@inheritDoc}
74      * @throws IOException {@inheritDoc}
75      */
76     @Override
77     public void flush() throws IOException {
78         this.os.flush();
79         return;
80     }
81
82 }