OSDN Git Service

Merge release/v3.122.2
[mikutoga/TogaGem.git] / src / main / java / jp / sfjp / mikutoga / bin / parser / ProxyParser.java
1 /*
2  * parser proxy
3  *
4  * License : The MIT License
5  * Copyright(c) 2013 MikuToga Partners
6  */
7
8 package jp.sfjp.mikutoga.bin.parser;
9
10 import java.io.IOException;
11
12 /**
13  * 委譲パーサ。
14  *
15  * <p>別のパーサにパース処理を委譲する。
16  */
17 public class ProxyParser implements BinParser{
18
19     private final BinParser delegate;
20
21
22     /**
23      * コンストラクタ。
24      * @param delegate 委譲先パーサ
25      * @throws NullPointerException 引数がnull
26      */
27     public ProxyParser(BinParser delegate) throws NullPointerException{
28         super();
29
30         if(delegate == null) throw new NullPointerException();
31         this.delegate = delegate;
32
33         return;
34     }
35
36     /**
37      * {@inheritDoc}
38      * @return {@inheritDoc}
39      */
40     @Override
41     public long getPosition() {
42         return this.delegate.getPosition();
43     }
44
45     /**
46      * {@inheritDoc}
47      * @return {@inheritDoc}
48      * @throws IOException {@inheritDoc}
49      */
50     @Override
51     public boolean hasMore() throws IOException {
52         return this.delegate.hasMore();
53     }
54
55     /**
56      * {@inheritDoc}
57      * @param skipLength {@inheritDoc}
58      * @throws IOException {@inheritDoc}
59      * @throws MmdEofException {@inheritDoc}
60      */
61     @Override
62     public void skip(long skipLength) throws IOException, MmdEofException {
63         this.delegate.skip(skipLength);
64         return;
65     }
66
67     /**
68      * {@inheritDoc}
69      * @param dst {@inheritDoc}
70      * @param off {@inheritDoc}
71      * @param length {@inheritDoc}
72      * @throws NullPointerException {@inheritDoc}
73      * @throws IndexOutOfBoundsException {@inheritDoc}
74      * @throws IOException {@inheritDoc}
75      * @throws MmdEofException {@inheritDoc}
76      */
77     @Override
78     public void parseByteArray(byte[] dst, int off, int length)
79             throws NullPointerException,
80                    IndexOutOfBoundsException,
81                    IOException,
82                    MmdEofException {
83         this.delegate.parseByteArray(dst, off, length);
84         return;
85     }
86
87     /**
88      * {@inheritDoc}
89      * @param dst {@inheritDoc}
90      * @throws NullPointerException {@inheritDoc}
91      * @throws IOException {@inheritDoc}
92      * @throws MmdEofException {@inheritDoc}
93      */
94     @Override
95     public void parseByteArray(byte[] dst)
96             throws NullPointerException,
97                    IOException,
98                    MmdEofException {
99         this.delegate.parseByteArray(dst);
100         return;
101     }
102
103     /**
104      * {@inheritDoc}
105      * @return {@inheritDoc}
106      * @throws IOException {@inheritDoc}
107      * @throws MmdEofException {@inheritDoc}
108      */
109     @Override
110     public byte parseByte() throws IOException, MmdEofException {
111         return this.delegate.parseByte();
112     }
113
114     /**
115      * {@inheritDoc}
116      * @return {@inheritDoc}
117      * @throws IOException {@inheritDoc}
118      * @throws MmdEofException {@inheritDoc}
119      */
120     @Override
121     public int parseUByteAsInt() throws IOException, MmdEofException {
122         return this.delegate.parseUByteAsInt();
123     }
124
125     /**
126      * {@inheritDoc}
127      * @return {@inheritDoc}
128      * @throws IOException {@inheritDoc}
129      * @throws MmdEofException {@inheritDoc}
130      */
131     @Override
132     public boolean parseBoolean() throws IOException, MmdEofException {
133         return this.delegate.parseBoolean();
134     }
135
136     /**
137      * {@inheritDoc}
138      * @return {@inheritDoc}
139      * @throws IOException {@inheritDoc}
140      * @throws MmdEofException {@inheritDoc}
141      */
142     @Override
143     public short parseLeShort() throws IOException, MmdEofException {
144         return this.delegate.parseLeShort();
145     }
146
147     /**
148      * {@inheritDoc}
149      * @return {@inheritDoc}
150      * @throws IOException {@inheritDoc}
151      * @throws MmdEofException {@inheritDoc}
152      */
153     @Override
154     public int parseLeUShortAsInt() throws IOException, MmdEofException {
155         return this.delegate.parseLeUShortAsInt();
156     }
157
158     /**
159      * {@inheritDoc}
160      * @return {@inheritDoc}
161      * @throws IOException {@inheritDoc}
162      * @throws MmdEofException {@inheritDoc}
163      */
164     @Override
165     public int parseLeInt() throws IOException, MmdEofException {
166         return this.delegate.parseLeInt();
167     }
168
169     /**
170      * {@inheritDoc}
171      * @return {@inheritDoc}
172      * @throws IOException {@inheritDoc}
173      * @throws MmdEofException {@inheritDoc}
174      */
175     @Override
176     public float parseLeFloat() throws IOException, MmdEofException {
177         return this.delegate.parseLeFloat();
178     }
179
180     /**
181      * {@inheritDoc}
182      * @param decoder {@inheritDoc}
183      * @param byteLen {@inheritDoc}
184      * @return {@inheritDoc}
185      * @throws IOException {@inheritDoc}
186      * @throws MmdEofException {@inheritDoc}
187      * @throws MmdFormatException {@inheritDoc}
188      */
189     @Override
190     public String parseString(TextDecoder decoder, int byteLen)
191             throws IOException, MmdEofException, MmdFormatException {
192         return this.delegate.parseString(decoder, byteLen);
193     }
194
195 }