2013-02-10 05:10:09 +01:00
|
|
|
/*
|
|
|
|
* Copyright 2013 The Netty Project
|
|
|
|
*
|
|
|
|
* 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:
|
|
|
|
*
|
2020-10-23 14:44:18 +02:00
|
|
|
* https://www.apache.org/licenses/LICENSE-2.0
|
2013-02-10 05:10:09 +01:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2021-09-17 16:28:14 +02:00
|
|
|
package io.net5.buffer;
|
2013-02-10 05:10:09 +01:00
|
|
|
|
2013-08-30 09:51:12 +02:00
|
|
|
import java.nio.ByteBuffer;
|
|
|
|
|
2013-02-17 20:12:48 +01:00
|
|
|
/**
|
|
|
|
* Abstract base class for {@link ByteBuf} implementations that wrap another
|
|
|
|
* {@link ByteBuf}.
|
2016-04-13 13:34:39 +02:00
|
|
|
*
|
|
|
|
* @deprecated Do not use.
|
2013-02-17 20:12:48 +01:00
|
|
|
*/
|
2016-04-13 13:34:39 +02:00
|
|
|
@Deprecated
|
2013-02-10 05:10:09 +01:00
|
|
|
public abstract class AbstractDerivedByteBuf extends AbstractByteBuf {
|
|
|
|
|
|
|
|
protected AbstractDerivedByteBuf(int maxCapacity) {
|
|
|
|
super(maxCapacity);
|
|
|
|
}
|
|
|
|
|
2019-02-28 20:40:42 +01:00
|
|
|
@Override
|
|
|
|
final boolean isAccessible() {
|
2020-08-28 09:18:13 +02:00
|
|
|
return isAccessible0();
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean isAccessible0() {
|
2019-02-28 20:40:42 +01:00
|
|
|
return unwrap().isAccessible();
|
|
|
|
}
|
|
|
|
|
2013-02-10 05:10:09 +01:00
|
|
|
@Override
|
|
|
|
public final int refCnt() {
|
2016-11-14 21:44:25 +01:00
|
|
|
return refCnt0();
|
|
|
|
}
|
|
|
|
|
|
|
|
int refCnt0() {
|
2013-02-10 05:10:09 +01:00
|
|
|
return unwrap().refCnt();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2013-02-13 08:09:33 +01:00
|
|
|
public final ByteBuf retain() {
|
2016-11-14 21:44:25 +01:00
|
|
|
return retain0();
|
|
|
|
}
|
|
|
|
|
|
|
|
ByteBuf retain0() {
|
2013-03-14 08:37:20 +01:00
|
|
|
unwrap().retain();
|
2013-02-13 08:09:33 +01:00
|
|
|
return this;
|
|
|
|
}
|
2013-02-10 05:10:09 +01:00
|
|
|
|
|
|
|
@Override
|
2013-02-13 08:09:33 +01:00
|
|
|
public final ByteBuf retain(int increment) {
|
2016-11-14 21:44:25 +01:00
|
|
|
return retain0(increment);
|
|
|
|
}
|
|
|
|
|
|
|
|
ByteBuf retain0(int increment) {
|
2013-03-14 08:37:20 +01:00
|
|
|
unwrap().retain(increment);
|
2013-02-13 08:09:33 +01:00
|
|
|
return this;
|
|
|
|
}
|
2013-02-10 05:10:09 +01:00
|
|
|
|
2014-01-28 12:00:28 +01:00
|
|
|
@Override
|
|
|
|
public final ByteBuf touch() {
|
2016-11-14 21:44:25 +01:00
|
|
|
return touch0();
|
|
|
|
}
|
|
|
|
|
|
|
|
ByteBuf touch0() {
|
2014-01-28 12:00:28 +01:00
|
|
|
unwrap().touch();
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2014-01-29 03:44:59 +01:00
|
|
|
@Override
|
|
|
|
public final ByteBuf touch(Object hint) {
|
2016-11-14 21:44:25 +01:00
|
|
|
return touch0(hint);
|
|
|
|
}
|
|
|
|
|
|
|
|
ByteBuf touch0(Object hint) {
|
2014-01-29 03:44:59 +01:00
|
|
|
unwrap().touch(hint);
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
2013-02-10 05:10:09 +01:00
|
|
|
@Override
|
|
|
|
public final boolean release() {
|
2016-11-14 21:44:25 +01:00
|
|
|
return release0();
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean release0() {
|
2015-08-26 22:24:44 +02:00
|
|
|
return unwrap().release();
|
2013-02-10 05:10:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public final boolean release(int decrement) {
|
2016-11-18 05:56:19 +01:00
|
|
|
return release0(decrement);
|
2013-02-10 05:10:09 +01:00
|
|
|
}
|
2013-08-30 09:51:12 +02:00
|
|
|
|
2016-11-14 21:44:25 +01:00
|
|
|
boolean release0(int decrement) {
|
|
|
|
return unwrap().release(decrement);
|
|
|
|
}
|
|
|
|
|
2016-04-13 11:21:17 +02:00
|
|
|
@Override
|
|
|
|
public boolean isReadOnly() {
|
|
|
|
return unwrap().isReadOnly();
|
|
|
|
}
|
|
|
|
|
2013-08-30 09:51:12 +02:00
|
|
|
@Override
|
|
|
|
public ByteBuffer internalNioBuffer(int index, int length) {
|
|
|
|
return nioBuffer(index, length);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public ByteBuffer nioBuffer(int index, int length) {
|
|
|
|
return unwrap().nioBuffer(index, length);
|
|
|
|
}
|
2019-11-06 12:06:25 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean isContiguous() {
|
|
|
|
return unwrap().isContiguous();
|
|
|
|
}
|
2013-02-10 05:10:09 +01:00
|
|
|
}
|