📄 iobufferwrapper.java
字号:
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * */package org.apache.mina.core.buffer;import java.io.FilterOutputStream;import java.io.InputStream;import java.io.OutputStream;import java.nio.ByteBuffer;import java.nio.ByteOrder;import java.nio.CharBuffer;import java.nio.DoubleBuffer;import java.nio.FloatBuffer;import java.nio.IntBuffer;import java.nio.LongBuffer;import java.nio.ShortBuffer;import java.nio.charset.CharacterCodingException;import java.nio.charset.CharsetDecoder;import java.nio.charset.CharsetEncoder;import java.util.EnumSet;import java.util.Set;/** * A {@link IoBuffer} that wraps a buffer and proxies any operations to it. * <p> * You can think this class like a {@link FilterOutputStream}. All operations * are proxied by default so that you can extend this class and override existing * operations selectively. You can introduce new operations, too. * * @author The Apache MINA Project (dev@mina.apache.org) * @version $Rev: 671827 $, $Date: 2008-06-26 10:49:48 +0200 (Thu, 26 Jun 2008) $ */public class IoBufferWrapper extends IoBuffer { /** * The buffer proxied by this proxy. */ private final IoBuffer buf; /** * Create a new instance. * @param buf the buffer to be proxied */ protected IoBufferWrapper(IoBuffer buf) { if (buf == null) { throw new NullPointerException("buf"); } this.buf = buf; } /** * Returns the parent buffer that this buffer wrapped. */ public IoBuffer getParentBuffer() { return buf; } @Override public boolean isDirect() { return buf.isDirect(); } @Override public ByteBuffer buf() { return buf.buf(); } @Override public int capacity() { return buf.capacity(); } @Override public int position() { return buf.position(); } @Override public IoBuffer position(int newPosition) { buf.position(newPosition); return this; } @Override public int limit() { return buf.limit(); } @Override public IoBuffer limit(int newLimit) { buf.limit(newLimit); return this; } @Override public IoBuffer mark() { buf.mark(); return this; } @Override public IoBuffer reset() { buf.reset(); return this; } @Override public IoBuffer clear() { buf.clear(); return this; } @Override public IoBuffer sweep() { buf.sweep(); return this; } @Override public IoBuffer sweep(byte value) { buf.sweep(value); return this; } @Override public IoBuffer flip() { buf.flip(); return this; } @Override public IoBuffer rewind() { buf.rewind(); return this; } @Override public int remaining() { return buf.remaining(); } @Override public boolean hasRemaining() { return buf.hasRemaining(); } @Override public byte get() { return buf.get(); } @Override public short getUnsigned() { return buf.getUnsigned(); } @Override public IoBuffer put(byte b) { buf.put(b); return this; } @Override public byte get(int index) { return buf.get(index); } @Override public short getUnsigned(int index) { return buf.getUnsigned(index); } @Override public IoBuffer put(int index, byte b) { buf.put(index, b); return this; } @Override public IoBuffer get(byte[] dst, int offset, int length) { buf.get(dst, offset, length); return this; } @Override public IoBuffer getSlice(int index, int length) { return buf.getSlice(index, length); } @Override public IoBuffer getSlice(int length) { return buf.getSlice(length); } @Override public IoBuffer get(byte[] dst) { buf.get(dst); return this; } @Override public IoBuffer put(IoBuffer src) { buf.put(src); return this; } @Override public IoBuffer put(ByteBuffer src) { buf.put(src); return this; } @Override public IoBuffer put(byte[] src, int offset, int length) { buf.put(src, offset, length); return this; } @Override public IoBuffer put(byte[] src) { buf.put(src); return this; } @Override public IoBuffer compact() { buf.compact(); return this; } @Override public String toString() { return buf.toString(); } @Override public int hashCode() { return buf.hashCode(); } @Override public boolean equals(Object ob) { return buf.equals(ob); } public int compareTo(IoBuffer that) { return buf.compareTo(that); } @Override public ByteOrder order() { return buf.order(); } @Override public IoBuffer order(ByteOrder bo) { buf.order(bo); return this; } @Override public char getChar() { return buf.getChar(); } @Override public IoBuffer putChar(char value) { buf.putChar(value); return this; } @Override public char getChar(int index) { return buf.getChar(index); } @Override public IoBuffer putChar(int index, char value) { buf.putChar(index, value); return this; } @Override public CharBuffer asCharBuffer() { return buf.asCharBuffer(); } @Override public short getShort() { return buf.getShort(); } @Override public int getUnsignedShort() { return buf.getUnsignedShort(); } @Override public IoBuffer putShort(short value) { buf.putShort(value); return this; } @Override public short getShort(int index) { return buf.getShort(index); } @Override public int getUnsignedShort(int index) { return buf.getUnsignedShort(index); } @Override public IoBuffer putShort(int index, short value) { buf.putShort(index, value); return this; } @Override public ShortBuffer asShortBuffer() { return buf.asShortBuffer(); } @Override public int getInt() { return buf.getInt(); } @Override public long getUnsignedInt() { return buf.getUnsignedInt(); } @Override public IoBuffer putInt(int value) { buf.putInt(value); return this; } @Override public int getInt(int index) { return buf.getInt(index); } @Override public long getUnsignedInt(int index) { return buf.getUnsignedInt(index); } @Override public IoBuffer putInt(int index, int value) { buf.putInt(index, value); return this; } @Override public IntBuffer asIntBuffer() { return buf.asIntBuffer(); } @Override public long getLong() { return buf.getLong(); } @Override public IoBuffer putLong(long value) { buf.putLong(value); return this; } @Override public long getLong(int index) { return buf.getLong(index); } @Override public IoBuffer putLong(int index, long value) { buf.putLong(index, value); return this; } @Override public LongBuffer asLongBuffer() { return buf.asLongBuffer(); } @Override public float getFloat() { return buf.getFloat(); } @Override public IoBuffer putFloat(float value) { buf.putFloat(value); return this; } @Override public float getFloat(int index) { return buf.getFloat(index); } @Override public IoBuffer putFloat(int index, float value) { buf.putFloat(index, value); return this; } @Override public FloatBuffer asFloatBuffer() { return buf.asFloatBuffer(); } @Override public double getDouble() { return buf.getDouble(); } @Override public IoBuffer putDouble(double value) { buf.putDouble(value); return this; } @Override public double getDouble(int index) { return buf.getDouble(index); } @Override public IoBuffer putDouble(int index, double value) { buf.putDouble(index, value); return this;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -