OSDN Git Service

535f6d6b9cabafb64aba601242f56165f51f933a
[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 offset = 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         return;
34     }
35
36     /**
37      * デバッガ用監視場所。
38      */
39     private void after(){
40         this.offset++;
41         return;
42     }
43
44     /**
45      * {@inheritDoc}
46      * @param b {@inheritDoc}
47      * @throws IOException {@inheritDoc}
48      */
49     @Override
50     public void write(int b) throws IOException {
51         before();
52
53         this.os.write(b);
54
55         after();
56
57         return;
58     }
59
60     /**
61      * {@inheritDoc}
62      * @throws IOException {@inheritDoc}
63      */
64     @Override
65     public void close() throws IOException {
66         this.os.close();
67         return;
68     }
69
70     /**
71      * {@inheritDoc}
72      * @throws IOException {@inheritDoc}
73      */
74     @Override
75     public void flush() throws IOException {
76         this.os.flush();
77         return;
78     }
79
80 }