1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.mina.common;
21
22 import java.io.FilterOutputStream;
23 import java.io.InputStream;
24 import java.io.OutputStream;
25 import java.nio.ByteOrder;
26 import java.nio.CharBuffer;
27 import java.nio.DoubleBuffer;
28 import java.nio.FloatBuffer;
29 import java.nio.IntBuffer;
30 import java.nio.LongBuffer;
31 import java.nio.ShortBuffer;
32 import java.nio.charset.CharacterCodingException;
33 import java.nio.charset.CharsetDecoder;
34 import java.nio.charset.CharsetEncoder;
35
36
37
38
39
40
41
42
43
44
45
46 public class ByteBufferProxy extends ByteBuffer {
47
48
49
50
51 protected ByteBuffer buf;
52
53
54
55
56
57 protected ByteBufferProxy(ByteBuffer buf) {
58 if (buf == null) {
59 throw new NullPointerException("buf");
60 }
61 this.buf = buf;
62 }
63
64 public void acquire() {
65 buf.acquire();
66 }
67
68 public void release() {
69 buf.release();
70 }
71
72 public boolean isDirect() {
73 return buf.isDirect();
74 }
75
76 public java.nio.ByteBuffer buf() {
77 return buf.buf();
78 }
79
80 public int capacity() {
81 return buf.capacity();
82 }
83
84 public int position() {
85 return buf.position();
86 }
87
88 public ByteBuffer position(int newPosition) {
89 buf.position(newPosition);
90 return this;
91 }
92
93 public int limit() {
94 return buf.limit();
95 }
96
97 public ByteBuffer limit(int newLimit) {
98 buf.limit(newLimit);
99 return this;
100 }
101
102 public ByteBuffer mark() {
103 buf.mark();
104 return this;
105 }
106
107 public ByteBuffer reset() {
108 buf.reset();
109 return this;
110 }
111
112 public ByteBuffer clear() {
113 buf.clear();
114 return this;
115 }
116
117 public ByteBuffer sweep() {
118 buf.sweep();
119 return this;
120 }
121
122 public ByteBuffer sweep(byte value) {
123 buf.sweep(value);
124 return this;
125 }
126
127 public ByteBuffer flip() {
128 buf.flip();
129 return this;
130 }
131
132 public ByteBuffer rewind() {
133 buf.rewind();
134 return this;
135 }
136
137 public int remaining() {
138 return buf.remaining();
139 }
140
141 public boolean hasRemaining() {
142 return buf.hasRemaining();
143 }
144
145 public byte get() {
146 return buf.get();
147 }
148
149 public short getUnsigned() {
150 return buf.getUnsigned();
151 }
152
153 public ByteBuffer put(byte b) {
154 buf.put(b);
155 return this;
156 }
157
158 public byte get(int index) {
159 return buf.get(index);
160 }
161
162 public short getUnsigned(int index) {
163 return buf.getUnsigned(index);
164 }
165
166 public ByteBuffer put(int index, byte b) {
167 buf.put(index, b);
168 return this;
169 }
170
171 public ByteBuffer get(byte[] dst, int offset, int length) {
172 buf.get(dst, offset, length);
173 return this;
174 }
175
176 public ByteBuffer get(byte[] dst) {
177 buf.get(dst);
178 return this;
179 }
180
181 public ByteBuffer put(ByteBuffer src) {
182 buf.put(src);
183 return this;
184 }
185
186 public ByteBuffer put(java.nio.ByteBuffer src) {
187 buf.put(src);
188 return this;
189 }
190
191 public ByteBuffer put(byte[] src, int offset, int length) {
192 buf.put(src, offset, length);
193 return this;
194 }
195
196 public ByteBuffer put(byte[] src) {
197 buf.put(src);
198 return this;
199 }
200
201 public ByteBuffer compact() {
202 buf.compact();
203 return this;
204 }
205
206 public String toString() {
207 return buf.toString();
208 }
209
210 public int hashCode() {
211 return buf.hashCode();
212 }
213
214 public boolean equals(Object ob) {
215 return buf.equals(ob);
216 }
217
218 public int compareTo(ByteBuffer that) {
219 return buf.compareTo(that);
220 }
221
222 public ByteOrder order() {
223 return buf.order();
224 }
225
226 public ByteBuffer order(ByteOrder bo) {
227 buf.order(bo);
228 return this;
229 }
230
231 public char getChar() {
232 return buf.getChar();
233 }
234
235 public ByteBuffer putChar(char value) {
236 buf.putChar(value);
237 return this;
238 }
239
240 public char getChar(int index) {
241 return buf.getChar(index);
242 }
243
244 public ByteBuffer putChar(int index, char value) {
245 buf.putChar(index, value);
246 return this;
247 }
248
249 public CharBuffer asCharBuffer() {
250 return buf.asCharBuffer();
251 }
252
253 public short getShort() {
254 return buf.getShort();
255 }
256
257 public int getUnsignedShort() {
258 return buf.getUnsignedShort();
259 }
260
261 public ByteBuffer putShort(short value) {
262 buf.putShort(value);
263 return this;
264 }
265
266 public short getShort(int index) {
267 return buf.getShort(index);
268 }
269
270 public int getUnsignedShort(int index) {
271 return buf.getUnsignedShort(index);
272 }
273
274 public ByteBuffer putShort(int index, short value) {
275 buf.putShort(index, value);
276 return this;
277 }
278
279 public ShortBuffer asShortBuffer() {
280 return buf.asShortBuffer();
281 }
282
283 public int getInt() {
284 return buf.getInt();
285 }
286
287 public long getUnsignedInt() {
288 return buf.getUnsignedInt();
289 }
290
291 public ByteBuffer putInt(int value) {
292 buf.putInt(value);
293 return this;
294 }
295
296 public int getInt(int index) {
297 return buf.getInt(index);
298 }
299
300 public long getUnsignedInt(int index) {
301 return buf.getUnsignedInt(index);
302 }
303
304 public ByteBuffer putInt(int index, int value) {
305 buf.putInt(index, value);
306 return this;
307 }
308
309 public IntBuffer asIntBuffer() {
310 return buf.asIntBuffer();
311 }
312
313 public long getLong() {
314 return buf.getLong();
315 }
316
317 public ByteBuffer putLong(long value) {
318 buf.putLong(value);
319 return this;
320 }
321
322 public long getLong(int index) {
323 return buf.getLong(index);
324 }
325
326 public ByteBuffer putLong(int index, long value) {
327 buf.putLong(index, value);
328 return this;
329 }
330
331 public LongBuffer asLongBuffer() {
332 return buf.asLongBuffer();
333 }
334
335 public float getFloat() {
336 return buf.getFloat();
337 }
338
339 public ByteBuffer putFloat(float value) {
340 buf.putFloat(value);
341 return this;
342 }
343
344 public float getFloat(int index) {
345 return buf.getFloat(index);
346 }
347
348 public ByteBuffer putFloat(int index, float value) {
349 buf.putFloat(index, value);
350 return this;
351 }
352
353 public FloatBuffer asFloatBuffer() {
354 return buf.asFloatBuffer();
355 }
356
357 public double getDouble() {
358 return buf.getDouble();
359 }
360
361 public ByteBuffer putDouble(double value) {
362 buf.putDouble(value);
363 return this;
364 }
365
366 public double getDouble(int index) {
367 return buf.getDouble(index);
368 }
369
370 public ByteBuffer putDouble(int index, double value) {
371 buf.putDouble(index, value);
372 return this;
373 }
374
375 public DoubleBuffer asDoubleBuffer() {
376 return buf.asDoubleBuffer();
377 }
378
379 public String getHexDump() {
380 return buf.getHexDump();
381 }
382
383 public String getString(int fieldSize, CharsetDecoder decoder)
384 throws CharacterCodingException {
385 return buf.getString(fieldSize, decoder);
386 }
387
388 public String getString(CharsetDecoder decoder)
389 throws CharacterCodingException {
390 return buf.getString(decoder);
391 }
392
393 public String getPrefixedString(CharsetDecoder decoder)
394 throws CharacterCodingException {
395 return buf.getPrefixedString(decoder);
396 }
397
398 public String getPrefixedString(int prefixLength, CharsetDecoder decoder)
399 throws CharacterCodingException {
400 return buf.getPrefixedString(prefixLength, decoder);
401 }
402
403 public ByteBuffer putString(CharSequence in, int fieldSize,
404 CharsetEncoder encoder) throws CharacterCodingException {
405 buf.putString(in, fieldSize, encoder);
406 return this;
407 }
408
409 public ByteBuffer putString(CharSequence in, CharsetEncoder encoder)
410 throws CharacterCodingException {
411 buf.putString(in, encoder);
412 return this;
413 }
414
415 public ByteBuffer putPrefixedString(CharSequence in, CharsetEncoder encoder)
416 throws CharacterCodingException {
417 buf.putPrefixedString(in, encoder);
418 return this;
419 }
420
421 public ByteBuffer putPrefixedString(CharSequence in, int prefixLength,
422 CharsetEncoder encoder) throws CharacterCodingException {
423 buf.putPrefixedString(in, prefixLength, encoder);
424 return this;
425 }
426
427 public ByteBuffer putPrefixedString(CharSequence in, int prefixLength,
428 int padding, CharsetEncoder encoder)
429 throws CharacterCodingException {
430 buf.putPrefixedString(in, prefixLength, padding, encoder);
431 return this;
432 }
433
434 public ByteBuffer putPrefixedString(CharSequence in, int prefixLength,
435 int padding, byte padValue, CharsetEncoder encoder)
436 throws CharacterCodingException {
437 buf.putPrefixedString(in, prefixLength, padding, padValue, encoder);
438 return this;
439 }
440
441 public ByteBuffer skip(int size) {
442 buf.skip(size);
443 return this;
444 }
445
446 public ByteBuffer fill(byte value, int size) {
447 buf.fill(value, size);
448 return this;
449 }
450
451 public ByteBuffer fillAndReset(byte value, int size) {
452 buf.fillAndReset(value, size);
453 return this;
454 }
455
456 public ByteBuffer fill(int size) {
457 buf.fill(size);
458 return this;
459 }
460
461 public ByteBuffer fillAndReset(int size) {
462 buf.fillAndReset(size);
463 return this;
464 }
465
466 public boolean isAutoExpand() {
467 return buf.isAutoExpand();
468 }
469
470 public ByteBuffer setAutoExpand(boolean autoExpand) {
471 buf.setAutoExpand(autoExpand);
472 return this;
473 }
474
475 public ByteBuffer expand(int pos, int expectedRemaining) {
476 buf.expand(pos, expectedRemaining);
477 return this;
478 }
479
480 public ByteBuffer expand(int expectedRemaining) {
481 buf.expand(expectedRemaining);
482 return this;
483 }
484
485 public boolean isPooled() {
486 return buf.isPooled();
487 }
488
489 public void setPooled(boolean pooled) {
490 buf.setPooled(pooled);
491 }
492
493 public Object getObject() throws ClassNotFoundException {
494 return buf.getObject();
495 }
496
497 public Object getObject(ClassLoader classLoader)
498 throws ClassNotFoundException {
499 return buf.getObject(classLoader);
500 }
501
502 public ByteBuffer putObject(Object o) {
503 buf.putObject(o);
504 return this;
505 }
506
507 public InputStream asInputStream() {
508 return buf.asInputStream();
509 }
510
511 public OutputStream asOutputStream() {
512 return buf.asOutputStream();
513 }
514
515 public ByteBuffer duplicate() {
516 return buf.duplicate();
517 }
518
519 public ByteBuffer slice() {
520 return buf.slice();
521 }
522
523 public ByteBuffer asReadOnlyBuffer() {
524 return buf.asReadOnlyBuffer();
525 }
526
527 public byte[] array() {
528 return buf.array();
529 }
530
531 public int arrayOffset() {
532 return buf.arrayOffset();
533 }
534
535 public ByteBuffer capacity(int newCapacity) {
536 buf.capacity(newCapacity);
537 return this;
538 }
539
540 public boolean isReadOnly() {
541 return buf.isReadOnly();
542 }
543
544 public int markValue() {
545 return buf.markValue();
546 }
547 }