2008-08-08 02:37:18 +02:00
|
|
|
/*
|
2012-06-04 22:31:44 +02:00
|
|
|
* Copyright 2012 The Netty Project
|
2008-08-08 02:37:18 +02:00
|
|
|
*
|
2011-12-09 06:18:34 +01:00
|
|
|
* The Netty Project 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:
|
2008-08-08 02:37:18 +02:00
|
|
|
*
|
2020-10-23 14:44:18 +02:00
|
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
2008-08-08 03:27:24 +02:00
|
|
|
*
|
2009-08-28 09:15:49 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
2011-12-09 06:18:34 +01:00
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
2009-08-28 09:15:49 +02:00
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2008-08-08 02:37:18 +02:00
|
|
|
*/
|
2021-09-17 16:28:14 +02:00
|
|
|
package io.net5.buffer;
|
2008-08-08 02:37:18 +02:00
|
|
|
|
2021-09-17 16:28:14 +02:00
|
|
|
import io.net5.util.ByteProcessor;
|
2015-04-01 01:23:52 +02:00
|
|
|
|
2008-08-08 02:37:18 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.nio.ByteBuffer;
|
2012-11-15 22:04:37 +01:00
|
|
|
import java.nio.ByteOrder;
|
2009-02-13 11:21:28 +01:00
|
|
|
import java.nio.ReadOnlyBufferException;
|
2016-02-05 04:02:40 +01:00
|
|
|
import java.nio.channels.FileChannel;
|
2008-08-08 02:37:18 +02:00
|
|
|
import java.nio.channels.GatheringByteChannel;
|
|
|
|
import java.nio.channels.ScatteringByteChannel;
|
|
|
|
|
2008-08-10 07:52:36 +02:00
|
|
|
/**
|
2008-09-02 09:13:20 +02:00
|
|
|
* A derived buffer which forbids any write requests to its parent. It is
|
2012-06-11 10:02:00 +02:00
|
|
|
* recommended to use {@link Unpooled#unmodifiableBuffer(ByteBuf)}
|
2008-09-02 09:13:20 +02:00
|
|
|
* instead of calling the constructor explicitly.
|
2016-04-13 13:34:39 +02:00
|
|
|
*
|
|
|
|
* @deprecated Do not use.
|
2008-08-10 07:52:36 +02:00
|
|
|
*/
|
2016-04-13 13:34:39 +02:00
|
|
|
@Deprecated
|
2013-02-10 05:10:09 +01:00
|
|
|
public class ReadOnlyByteBuf extends AbstractDerivedByteBuf {
|
2008-08-08 02:37:18 +02:00
|
|
|
|
2012-12-05 11:28:56 +01:00
|
|
|
private final ByteBuf buffer;
|
2008-08-08 02:37:18 +02:00
|
|
|
|
2012-12-05 11:28:56 +01:00
|
|
|
public ReadOnlyByteBuf(ByteBuf buffer) {
|
2012-11-15 22:04:37 +01:00
|
|
|
super(buffer.maxCapacity());
|
2008-08-08 02:37:18 +02:00
|
|
|
|
2013-01-17 05:55:48 +01:00
|
|
|
if (buffer instanceof ReadOnlyByteBuf || buffer instanceof DuplicatedByteBuf) {
|
|
|
|
this.buffer = buffer.unwrap();
|
|
|
|
} else {
|
|
|
|
this.buffer = buffer;
|
2012-11-15 22:04:37 +01:00
|
|
|
}
|
2008-08-08 02:37:18 +02:00
|
|
|
setIndex(buffer.readerIndex(), buffer.writerIndex());
|
|
|
|
}
|
|
|
|
|
2016-04-13 11:21:17 +02:00
|
|
|
@Override
|
|
|
|
public boolean isReadOnly() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-06-05 10:55:03 +02:00
|
|
|
@Override
|
|
|
|
public boolean isWritable() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isWritable(int numBytes) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-07-21 02:52:54 +02:00
|
|
|
@Override
|
|
|
|
public int ensureWritable(int minWritableBytes, boolean force) {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ByteBuf ensureWritable(int minWritableBytes) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2019-12-13 06:20:30 +01:00
|
|
|
@Override
|
|
|
|
public int writableBytes() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int maxWritableBytes() {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-06-10 04:08:43 +02:00
|
|
|
public ByteBuf unwrap() {
|
2008-08-08 02:37:18 +02:00
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2012-11-15 22:04:37 +01:00
|
|
|
@Override
|
|
|
|
public ByteBufAllocator alloc() {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().alloc();
|
2012-11-15 22:04:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-04-13 13:34:39 +02:00
|
|
|
@Deprecated
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteOrder order() {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().order();
|
2012-11-15 22:04:37 +01:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2010-01-27 06:07:32 +01:00
|
|
|
public boolean isDirect() {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().isDirect();
|
2010-01-27 06:07:32 +01:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2009-11-25 08:08:52 +01:00
|
|
|
public boolean hasArray() {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2009-11-25 08:08:52 +01:00
|
|
|
public byte[] array() {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2009-11-25 08:08:52 +01:00
|
|
|
public int arrayOffset() {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2013-03-06 10:22:16 +01:00
|
|
|
@Override
|
|
|
|
public boolean hasMemoryAddress() {
|
2017-06-07 10:33:54 +02:00
|
|
|
return unwrap().hasMemoryAddress();
|
2013-03-06 10:22:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long memoryAddress() {
|
2017-06-07 10:33:54 +02:00
|
|
|
return unwrap().memoryAddress();
|
2013-03-06 10:22:16 +01:00
|
|
|
}
|
|
|
|
|
2008-08-08 02:37:18 +02:00
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf discardReadBytes() {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2013-03-06 02:32:29 +01:00
|
|
|
public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2013-03-06 02:32:29 +01:00
|
|
|
public ByteBuf setBytes(int index, byte[] src, int srcIndex, int length) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2013-03-06 02:32:29 +01:00
|
|
|
public ByteBuf setBytes(int index, ByteBuffer src) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2013-03-06 02:32:29 +01:00
|
|
|
public ByteBuf setByte(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void _setByte(int index, int value) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf setShort(int index, int value) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2013-03-06 02:32:29 +01:00
|
|
|
@Override
|
|
|
|
protected void _setShort(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2016-04-13 13:34:39 +02:00
|
|
|
@Override
|
|
|
|
public ByteBuf setShortLE(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2015-11-16 22:20:16 +01:00
|
|
|
@Override
|
|
|
|
protected void _setShortLE(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf setMedium(int index, int value) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2013-03-06 02:32:29 +01:00
|
|
|
@Override
|
|
|
|
protected void _setMedium(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2016-04-13 13:34:39 +02:00
|
|
|
@Override
|
|
|
|
public ByteBuf setMediumLE(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2015-11-16 22:20:16 +01:00
|
|
|
@Override
|
|
|
|
protected void _setMediumLE(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf setInt(int index, int value) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2013-03-06 02:32:29 +01:00
|
|
|
@Override
|
|
|
|
protected void _setInt(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2016-04-13 13:34:39 +02:00
|
|
|
@Override
|
|
|
|
public ByteBuf setIntLE(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2015-11-16 22:20:16 +01:00
|
|
|
@Override
|
|
|
|
protected void _setIntLE(int index, int value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf setLong(int index, long value) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2013-03-06 02:32:29 +01:00
|
|
|
@Override
|
|
|
|
protected void _setLong(int index, long value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2016-04-13 13:34:39 +02:00
|
|
|
@Override
|
|
|
|
public ByteBuf setLongLE(int index, long value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2015-11-16 22:20:16 +01:00
|
|
|
@Override
|
|
|
|
protected void _setLongLE(int index, long value) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-12-05 11:28:56 +01:00
|
|
|
public int setBytes(int index, InputStream in, int length) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-12-05 11:28:56 +01:00
|
|
|
public int setBytes(int index, ScatteringByteChannel in, int length) {
|
2009-02-13 11:21:28 +01:00
|
|
|
throw new ReadOnlyBufferException();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2016-02-05 04:02:40 +01:00
|
|
|
@Override
|
|
|
|
public int setBytes(int index, FileChannel in, long position, int length) {
|
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2008-08-08 02:37:18 +02:00
|
|
|
public int getBytes(int index, GatheringByteChannel out, int length)
|
|
|
|
throws IOException {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getBytes(index, out, length);
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2016-02-05 04:02:40 +01:00
|
|
|
@Override
|
|
|
|
public int getBytes(int index, FileChannel out, long position, int length)
|
|
|
|
throws IOException {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getBytes(index, out, position, length);
|
2016-02-05 04:02:40 +01:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf getBytes(int index, OutputStream out, int length)
|
2008-08-08 02:37:18 +02:00
|
|
|
throws IOException {
|
2016-04-13 13:34:39 +02:00
|
|
|
unwrap().getBytes(index, out, length);
|
2012-10-18 08:57:23 +02:00
|
|
|
return this;
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length) {
|
2016-04-13 13:34:39 +02:00
|
|
|
unwrap().getBytes(index, dst, dstIndex, length);
|
2012-10-18 08:57:23 +02:00
|
|
|
return this;
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
|
2016-04-13 13:34:39 +02:00
|
|
|
unwrap().getBytes(index, dst, dstIndex, length);
|
2012-10-18 08:57:23 +02:00
|
|
|
return this;
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf getBytes(int index, ByteBuffer dst) {
|
2016-04-13 13:34:39 +02:00
|
|
|
unwrap().getBytes(index, dst);
|
2012-10-18 08:57:23 +02:00
|
|
|
return this;
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-06-10 04:08:43 +02:00
|
|
|
public ByteBuf duplicate() {
|
|
|
|
return new ReadOnlyByteBuf(this);
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-06-10 04:08:43 +02:00
|
|
|
public ByteBuf copy(int index, int length) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().copy(index, length);
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-06-10 04:08:43 +02:00
|
|
|
public ByteBuf slice(int index, int length) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return Unpooled.unmodifiableBuffer(unwrap().slice(index, length));
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2008-08-08 02:37:18 +02:00
|
|
|
public byte getByte(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getByte(index);
|
2013-03-06 02:32:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected byte _getByte(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getByte(index);
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2008-08-08 02:37:18 +02:00
|
|
|
public short getShort(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getShort(index);
|
2013-03-06 02:32:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected short _getShort(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getShort(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public short getShortLE(int index) {
|
|
|
|
return unwrap().getShortLE(index);
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2015-11-16 22:20:16 +01:00
|
|
|
@Override
|
|
|
|
protected short _getShortLE(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getShortLE(index);
|
2015-11-16 22:20:16 +01:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2008-08-10 02:52:59 +02:00
|
|
|
public int getUnsignedMedium(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getUnsignedMedium(index);
|
2013-03-06 02:32:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected int _getUnsignedMedium(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getUnsignedMedium(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getUnsignedMediumLE(int index) {
|
|
|
|
return unwrap().getUnsignedMediumLE(index);
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2015-11-16 22:20:16 +01:00
|
|
|
@Override
|
|
|
|
protected int _getUnsignedMediumLE(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getUnsignedMediumLE(index);
|
2015-11-16 22:20:16 +01:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2008-08-08 02:37:18 +02:00
|
|
|
public int getInt(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getInt(index);
|
2013-03-06 02:32:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected int _getInt(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getInt(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getIntLE(int index) {
|
|
|
|
return unwrap().getIntLE(index);
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2015-11-16 22:20:16 +01:00
|
|
|
@Override
|
|
|
|
protected int _getIntLE(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getIntLE(index);
|
2015-11-16 22:20:16 +01:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2008-08-08 02:37:18 +02:00
|
|
|
public long getLong(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getLong(index);
|
2013-03-06 02:32:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected long _getLong(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getLong(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public long getLongLE(int index) {
|
|
|
|
return unwrap().getLongLE(index);
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
2015-11-16 22:20:16 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
protected long _getLongLE(int index) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().getLongLE(index);
|
2015-11-16 22:20:16 +01:00
|
|
|
}
|
2008-08-08 02:37:18 +02:00
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2012-12-14 04:20:33 +01:00
|
|
|
public int nioBufferCount() {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().nioBufferCount();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
|
|
|
|
2008-09-04 14:37:37 +02:00
|
|
|
@Override
|
2012-06-02 10:30:55 +02:00
|
|
|
public ByteBuffer nioBuffer(int index, int length) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().nioBuffer(index, length).asReadOnlyBuffer();
|
2008-09-04 14:37:37 +02:00
|
|
|
}
|
|
|
|
|
2012-08-13 02:29:07 +02:00
|
|
|
@Override
|
2012-12-05 22:11:48 +01:00
|
|
|
public ByteBuffer[] nioBuffers(int index, int length) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().nioBuffers(index, length);
|
2013-06-13 05:40:26 +02:00
|
|
|
}
|
|
|
|
|
2013-06-27 10:36:22 +02:00
|
|
|
@Override
|
2015-04-01 01:23:52 +02:00
|
|
|
public int forEachByte(int index, int length, ByteProcessor processor) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().forEachByte(index, length, processor);
|
2013-06-27 11:48:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-01 01:23:52 +02:00
|
|
|
public int forEachByteDesc(int index, int length, ByteProcessor processor) {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().forEachByteDesc(index, length, processor);
|
2013-06-27 10:36:22 +02:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2008-08-08 02:37:18 +02:00
|
|
|
public int capacity() {
|
2016-04-13 13:34:39 +02:00
|
|
|
return unwrap().capacity();
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|
2012-07-19 13:23:55 +02:00
|
|
|
|
|
|
|
@Override
|
2012-11-15 22:04:37 +01:00
|
|
|
public ByteBuf capacity(int newCapacity) {
|
2012-07-19 13:23:55 +02:00
|
|
|
throw new ReadOnlyBufferException();
|
|
|
|
}
|
2017-02-13 15:27:40 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public ByteBuf asReadOnly() {
|
|
|
|
return this;
|
|
|
|
}
|
2008-08-08 02:37:18 +02:00
|
|
|
}
|