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
|
|
|
|
|
|
|
/**
|
2008-09-02 09:13:20 +02:00
|
|
|
* A derived buffer which exposes its parent's sub-region only. It is
|
2012-06-10 04:08:43 +02:00
|
|
|
* recommended to use {@link ByteBuf#slice()} and
|
|
|
|
* {@link ByteBuf#slice(int, int)} instead of calling the constructor
|
2008-09-02 09:13:20 +02:00
|
|
|
* explicitly.
|
2016-04-13 13:34:39 +02:00
|
|
|
*
|
|
|
|
* @deprecated Do not use.
|
2008-08-08 02:37:18 +02:00
|
|
|
*/
|
2016-04-13 13:34:39 +02:00
|
|
|
@Deprecated
|
2016-07-26 21:50:56 +02:00
|
|
|
public class SlicedByteBuf extends AbstractUnpooledSlicedByteBuf {
|
2008-08-08 02:37:18 +02:00
|
|
|
|
2016-07-26 21:50:56 +02:00
|
|
|
private int length;
|
2008-08-08 02:37:18 +02:00
|
|
|
|
2012-12-05 11:28:56 +01:00
|
|
|
public SlicedByteBuf(ByteBuf buffer, int index, int length) {
|
2016-07-26 21:50:56 +02:00
|
|
|
super(buffer, index, length);
|
2012-11-15 22:04:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-07-26 21:50:56 +02:00
|
|
|
final void initLength(int length) {
|
|
|
|
this.length = length;
|
2012-11-15 22:04:37 +01:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2016-07-26 21:50:56 +02:00
|
|
|
final int length() {
|
|
|
|
return length;
|
2010-01-27 06:07:32 +01:00
|
|
|
}
|
|
|
|
|
2010-11-12 01:45:39 +01:00
|
|
|
@Override
|
2008-08-08 02:37:18 +02:00
|
|
|
public int capacity() {
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
}
|