Rename package from io.netty to io.netty5

This commit is contained in:
Andrea Cavalli 2021-09-03 23:36:02 +02:00
parent 683ff4230e
commit 73fd9c9392
2923 changed files with 1601 additions and 368847 deletions

View File

@ -57,75 +57,9 @@
<url>https://oss.sonatype.org/service/local/repositories/${stagingRepositoryId}/content/</url>
</repository>
</repositories>
<dependencies>
<!-- Depend on all our native jars -->
<!-- As this is executed on either macOS or Linux we directly need to specify the classifier -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-aarch_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
<profile>
<id>uber-snapshot</id>
<dependencies>
<!-- Depend on all our native jars -->
<!-- As this is executed on either macOS or Linux we directly need to specify the classifier -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<classifier>linux-aarch_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<classifier>osx-x86_64</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
<!-- The linux profile will only include the native jar for epol to the all jar.
@ -138,30 +72,6 @@
<family>linux</family>
</os>
</activation>
<dependencies>
<!-- All release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Just include the classes for the other platform so these are at least present in the netty-all artifact -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
<!-- The mac, openbsd and freebsd profile will only include the native jar for epol to the all jar.
If you want to also include the native jar for kqueue use -Puber.
@ -173,32 +83,6 @@
<family>mac</family>
</os>
</activation>
<dependencies>
<!-- All release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Just include the classes for the other platform so these are at least present in the netty-all artifact -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
<profile>
<id>freebsd</id>
@ -208,30 +92,6 @@
<name>freebsd</name>
</os>
</activation>
<dependencies>
<!-- All release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Just include the classes for the other platform so these are at least present in the netty-all artifact -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
<profile>
<id>openbsd</id>
@ -241,30 +101,6 @@
<name>openbsd</name>
</os>
</activation>
<dependencies>
<!-- All release modules -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>${project.version}</version>
<classifier>${jni.classifier}</classifier>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<!-- Just include the classes for the other platform so these are at least present in the netty-all artifact -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
</profile>
</profiles>
@ -276,120 +112,12 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-dns</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-haproxy</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-http</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-http2</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-memcache</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-mqtt</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-redis</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-smtp</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-socks</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-stomp</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-codec-xml</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-common</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-handler</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-handler-proxy</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-resolver-dns</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netty-transport-sctp</artifactId>
<scope>compile</scope>
<optional>true</optional>
</dependency>
</dependencies>
<build>

View File

@ -71,66 +71,6 @@
<artifactId>netty-buffer</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-dns</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-haproxy</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http2</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-memcache</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-mqtt</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-redis</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-smtp</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-socks</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-stomp</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-xml</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
@ -141,162 +81,11 @@
<artifactId>netty-dev-tools</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler-proxy</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-sctp</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-example</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-all</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
<classifier>osx-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
<classifier>linux-aarch_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
<classifier>osx-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
<classifier>linux-aarch_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-kqueue</artifactId>
<version>5.0.0.Final-SNAPSHOT</version>
<classifier>osx-x86_64</classifier>
</dependency>
<!-- Add netty-tcnative* as well as users need to ensure they use the correct version -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>${tcnative.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>${tcnative.version}</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>${tcnative.version}</version>
<classifier>linux-aarch_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>${tcnative.version}</version>
<classifier>osx-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${tcnative.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${tcnative.version}</version>
<classifier>linux-x86_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${tcnative.version}</version>
<classifier>linux-aarch_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${tcnative.version}</version>
<classifier>osx_64</classifier>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${tcnative.version}</version>
<classifier>windows_64</classifier>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@ -13,18 +13,18 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.AsciiString;
import io.netty.util.ByteProcessor;
import io.netty.util.CharsetUtil;
import io.netty.util.IllegalReferenceCountException;
import io.netty.util.ResourceLeakDetector;
import io.netty.util.ResourceLeakDetectorFactory;
import io.netty.util.internal.StringUtil;
import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty5.util.AsciiString;
import io.netty5.util.ByteProcessor;
import io.netty5.util.CharsetUtil;
import io.netty5.util.IllegalReferenceCountException;
import io.netty5.util.ResourceLeakDetector;
import io.netty5.util.ResourceLeakDetectorFactory;
import io.netty5.util.internal.StringUtil;
import io.netty5.util.internal.SystemPropertyUtil;
import io.netty5.util.internal.logging.InternalLogger;
import io.netty5.util.internal.logging.InternalLoggerFactory;
import java.io.IOException;
import java.io.InputStream;
@ -36,8 +36,8 @@ import java.nio.channels.GatheringByteChannel;
import java.nio.channels.ScatteringByteChannel;
import java.nio.charset.Charset;
import static io.netty.util.internal.MathUtil.isOutOfBounds;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty5.util.internal.MathUtil.isOutOfBounds;
import static io.netty5.util.internal.ObjectUtil.checkPositiveOrZero;
import static java.util.Objects.requireNonNull;
/**

View File

@ -14,15 +14,15 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty5.util.internal.ObjectUtil.checkPositiveOrZero;
import io.netty.util.ResourceLeakDetector;
import io.netty.util.ResourceLeakTracker;
import io.netty.util.internal.MathUtil;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.StringUtil;
import io.netty5.util.ResourceLeakDetector;
import io.netty5.util.ResourceLeakTracker;
import io.netty5.util.internal.MathUtil;
import io.netty5.util.internal.PlatformDependent;
import io.netty5.util.internal.StringUtil;
/**
* Skeletal {@link ByteBufAllocator} implementation to extend.

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import java.nio.ByteBuffer;

View File

@ -14,9 +14,9 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty5.util.internal.ObjectPool.Handle;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

View File

@ -14,11 +14,11 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import io.netty.util.internal.ReferenceCountUpdater;
import io.netty5.util.internal.ReferenceCountUpdater;
/**
* Abstract base class for {@link ByteBuf} implementations that count references.

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ByteProcessor;
import io.netty5.util.ByteProcessor;
import java.io.IOException;
import java.io.InputStream;
@ -27,7 +27,7 @@ import java.nio.channels.GatheringByteChannel;
import java.nio.channels.ScatteringByteChannel;
import java.nio.charset.Charset;
import static io.netty.util.internal.MathUtil.isOutOfBounds;
import static io.netty5.util.internal.MathUtil.isOutOfBounds;
abstract class AbstractUnpooledSlicedByteBuf extends AbstractDerivedByteBuf {
private final ByteBuf buffer;

View File

@ -13,13 +13,13 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
import java.nio.ByteOrder;
import static io.netty.util.internal.PlatformDependent.BIG_ENDIAN_NATIVE_ORDER;
import static io.netty5.util.internal.PlatformDependent.BIG_ENDIAN_NATIVE_ORDER;
/**
* Special {@link SwappedByteBuf} for {@link ByteBuf}s that is using unsafe.

View File

@ -14,14 +14,14 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ByteProcessor;
import io.netty.util.ResourceLeakDetector;
import io.netty.util.ResourceLeakTracker;
import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty5.util.ByteProcessor;
import io.netty5.util.ResourceLeakDetector;
import io.netty5.util.ResourceLeakTracker;
import io.netty5.util.internal.SystemPropertyUtil;
import io.netty5.util.internal.logging.InternalLogger;
import io.netty5.util.internal.logging.InternalLoggerFactory;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,10 +13,10 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ByteProcessor;
import io.netty.util.ReferenceCounted;
import io.netty5.util.ByteProcessor;
import io.netty5.util.ReferenceCounted;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* Implementations are responsible to allocate buffers. Implementations of this interface are expected to be

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
public interface ByteBufAllocatorMetric {
/**

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
public interface ByteBufAllocatorMetricProvider {

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* An interface that can be implemented by any object that know how to turn itself into a {@link ByteBuf}.

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ReferenceCounted;
import io.netty5.util.ReferenceCounted;
/**
* A packet which is send or receive.

View File

@ -13,13 +13,13 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty5.util.internal.ObjectUtil.checkPositiveOrZero;
import io.netty.util.ReferenceCounted;
import io.netty.util.internal.StringUtil;
import io.netty5.util.ReferenceCounted;
import io.netty5.util.internal.StringUtil;
import java.io.DataInput;
import java.io.DataInputStream;

View File

@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import io.netty.util.CharsetUtil;
import io.netty5.util.CharsetUtil;
import java.io.DataOutput;
import java.io.DataOutputStream;

View File

@ -14,9 +14,9 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ByteProcessor;
import io.netty5.util.ByteProcessor;
/**
* @deprecated Use {@link ByteProcessor}.

View File

@ -13,21 +13,21 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.AsciiString;
import io.netty.util.ByteProcessor;
import io.netty.util.CharsetUtil;
import io.netty.util.IllegalReferenceCountException;
import io.netty.util.concurrent.FastThreadLocal;
import io.netty.util.internal.MathUtil;
import io.netty.util.internal.ObjectPool;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.StringUtil;
import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty5.util.AsciiString;
import io.netty5.util.ByteProcessor;
import io.netty5.util.CharsetUtil;
import io.netty5.util.IllegalReferenceCountException;
import io.netty5.util.concurrent.FastThreadLocal;
import io.netty5.util.internal.MathUtil;
import io.netty5.util.internal.ObjectPool;
import io.netty5.util.internal.ObjectPool.Handle;
import io.netty5.util.internal.PlatformDependent;
import io.netty5.util.internal.StringUtil;
import io.netty5.util.internal.SystemPropertyUtil;
import io.netty5.util.internal.logging.InternalLogger;
import io.netty5.util.internal.logging.InternalLoggerFactory;
import java.io.IOException;
import java.io.OutputStream;
@ -43,10 +43,10 @@ import java.nio.charset.CodingErrorAction;
import java.util.Arrays;
import java.util.Locale;
import static io.netty.util.internal.MathUtil.isOutOfBounds;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty.util.internal.StringUtil.NEWLINE;
import static io.netty.util.internal.StringUtil.isSurrogate;
import static io.netty5.util.internal.MathUtil.isOutOfBounds;
import static io.netty5.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty5.util.internal.StringUtil.NEWLINE;
import static io.netty5.util.internal.StringUtil.isSurrogate;
import static java.util.Objects.requireNonNull;
/**

View File

@ -13,15 +13,15 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import io.netty.util.ByteProcessor;
import io.netty.util.IllegalReferenceCountException;
import io.netty.util.ReferenceCountUtil;
import io.netty.util.internal.EmptyArrays;
import io.netty.util.internal.RecyclableArrayList;
import io.netty5.util.ByteProcessor;
import io.netty5.util.IllegalReferenceCountException;
import io.netty5.util.ReferenceCountUtil;
import io.netty5.util.internal.EmptyArrays;
import io.netty5.util.internal.RecyclableArrayList;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import io.netty.util.internal.StringUtil;
import io.netty5.util.internal.StringUtil;
/**
* Default implementation of a {@link ByteBufHolder} that holds it's data in a {@link ByteBuf}.

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ByteProcessor;
import io.netty5.util.ByteProcessor;
import java.io.IOException;
import java.io.InputStream;

View File

@ -14,15 +14,15 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty5.util.internal.ObjectUtil.checkPositiveOrZero;
import static java.util.Objects.requireNonNull;
import io.netty.util.ByteProcessor;
import io.netty.util.internal.EmptyArrays;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.StringUtil;
import io.netty5.util.ByteProcessor;
import io.netty5.util.internal.EmptyArrays;
import io.netty5.util.internal.PlatformDependent;
import io.netty5.util.internal.StringUtil;
import java.io.InputStream;
import java.io.OutputStream;

View File

@ -13,10 +13,10 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.EmptyArrays;
import io.netty.util.internal.RecyclableArrayList;
import io.netty5.util.internal.EmptyArrays;
import io.netty5.util.internal.RecyclableArrayList;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* Utility class for heap buffers.

View File

@ -14,10 +14,10 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.StringUtil;
import io.netty5.util.internal.PlatformDependent;
import io.netty5.util.internal.StringUtil;
import java.nio.ByteBuffer;
import java.util.ArrayList;
@ -26,7 +26,6 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.LongAdder;
import static io.netty.buffer.PoolChunk.isSubpage;
import static java.lang.Math.max;
abstract class PoolArena<T> extends SizeClasses implements PoolArenaMetric {
@ -235,7 +234,7 @@ abstract class PoolArena<T> extends SizeClasses implements PoolArenaMetric {
}
private static SizeClass sizeClass(long handle) {
return isSubpage(handle) ? SizeClass.Small : SizeClass.Normal;
return PoolChunk.isSubpage(handle) ? SizeClass.Small : SizeClass.Normal;
}
void freeChunk(PoolChunk<T> chunk, long handle, int normCapacity, SizeClass sizeClass, ByteBuffer nioBuffer,

View File

@ -14,7 +14,7 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import java.util.List;

View File

@ -13,10 +13,10 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.LongLongHashMap;
import io.netty.util.internal.LongPriorityQueue;
import io.netty5.util.internal.LongLongHashMap;
import io.netty5.util.internal.LongPriorityQueue;
import java.nio.ByteBuffer;
import java.util.ArrayDeque;

View File

@ -14,9 +14,9 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.StringUtil;
import io.netty5.util.internal.StringUtil;
import java.util.ArrayList;
import java.util.Collections;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* Metrics for a list of chunks.

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* Metrics for a chunk.

View File

@ -14,13 +14,12 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static io.netty.buffer.PoolChunk.RUN_OFFSET_SHIFT;
import static io.netty.buffer.PoolChunk.SIZE_SHIFT;
import static io.netty.buffer.PoolChunk.IS_USED_SHIFT;
import static io.netty.buffer.PoolChunk.IS_SUBPAGE_SHIFT;
import static io.netty.buffer.SizeClasses.LOG2_QUANTUM;
import static io.netty5.buffer.PoolChunk.RUN_OFFSET_SHIFT;
import static io.netty5.buffer.PoolChunk.SIZE_SHIFT;
import static io.netty5.buffer.PoolChunk.IS_USED_SHIFT;
import static io.netty5.buffer.PoolChunk.IS_SUBPAGE_SHIFT;
final class PoolSubpage<T> implements PoolSubpageMetric {
@ -59,7 +58,7 @@ final class PoolSubpage<T> implements PoolSubpageMetric {
this.runOffset = runOffset;
this.runSize = runSize;
this.elemSize = elemSize;
bitmap = new long[runSize >>> 6 + LOG2_QUANTUM]; // runSize / 64 / QUANTUM
bitmap = new long[runSize >>> 6 + SizeClasses.LOG2_QUANTUM]; // runSize / 64 / QUANTUM
doNotDestroy = true;
if (elemSize != 0) {

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* Metrics for a sub-page.

View File

@ -14,18 +14,18 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty5.util.internal.ObjectUtil.checkPositiveOrZero;
import io.netty.buffer.PoolArena.SizeClass;
import io.netty.util.internal.MathUtil;
import io.netty.util.internal.ObjectPool;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty5.buffer.PoolArena.SizeClass;
import io.netty5.util.internal.MathUtil;
import io.netty5.util.internal.ObjectPool;
import io.netty5.util.internal.ObjectPool.Handle;
import io.netty5.util.internal.PlatformDependent;
import io.netty5.util.internal.logging.InternalLogger;
import io.netty5.util.internal.logging.InternalLoggerFactory;
import java.nio.ByteBuffer;
import java.util.ArrayList;

View File

@ -14,9 +14,9 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty5.util.internal.ObjectPool.Handle;
import java.io.IOException;
import java.nio.ByteBuffer;

View File

@ -14,20 +14,20 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty5.util.internal.ObjectUtil.checkPositiveOrZero;
import io.netty.util.NettyRuntime;
import io.netty.util.concurrent.EventExecutor;
import io.netty.util.concurrent.FastThreadLocal;
import io.netty.util.concurrent.FastThreadLocalThread;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.StringUtil;
import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.ThreadExecutorMap;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty5.util.NettyRuntime;
import io.netty5.util.concurrent.EventExecutor;
import io.netty5.util.concurrent.FastThreadLocal;
import io.netty5.util.concurrent.FastThreadLocalThread;
import io.netty5.util.internal.PlatformDependent;
import io.netty5.util.internal.StringUtil;
import io.netty5.util.internal.SystemPropertyUtil;
import io.netty5.util.internal.ThreadExecutorMap;
import io.netty5.util.internal.logging.InternalLogger;
import io.netty5.util.internal.logging.InternalLoggerFactory;
import java.nio.ByteBuffer;
import java.util.ArrayList;

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.StringUtil;
import io.netty5.util.internal.StringUtil;
import java.util.List;

View File

@ -14,10 +14,10 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.ObjectPool;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty5.util.internal.ObjectPool;
import io.netty5.util.internal.ObjectPool.Handle;
import java.io.IOException;
import java.io.InputStream;

View File

@ -14,11 +14,11 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ByteProcessor;
import io.netty.util.internal.ObjectPool;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty5.util.ByteProcessor;
import io.netty5.util.internal.ObjectPool;
import io.netty5.util.internal.ObjectPool.Handle;
import java.io.IOException;
import java.io.InputStream;

View File

@ -12,11 +12,11 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.ObjectPool;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.ObjectPool;
import io.netty5.util.internal.ObjectPool.Handle;
import io.netty5.util.internal.PlatformDependent;
import java.io.IOException;
import java.io.InputStream;

View File

@ -14,11 +14,11 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ByteProcessor;
import io.netty.util.internal.ObjectPool;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty5.util.ByteProcessor;
import io.netty5.util.internal.ObjectPool;
import io.netty5.util.internal.ObjectPool.Handle;
import java.io.IOException;
import java.io.InputStream;
@ -28,7 +28,7 @@ import java.nio.channels.FileChannel;
import java.nio.channels.GatheringByteChannel;
import java.nio.channels.ScatteringByteChannel;
import static io.netty.buffer.AbstractUnpooledSlicedByteBuf.checkSliceOutOfBounds;
import static io.netty5.buffer.AbstractUnpooledSlicedByteBuf.checkSliceOutOfBounds;
final class PooledSlicedByteBuf extends AbstractPooledDerivedByteBuf {

View File

@ -14,11 +14,11 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.ObjectPool;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.ObjectPool;
import io.netty5.util.internal.ObjectPool.Handle;
import io.netty5.util.internal.PlatformDependent;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.ObjectPool;
import io.netty.util.internal.ObjectPool.Handle;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.ObjectPool;
import io.netty5.util.internal.ObjectPool.Handle;
import io.netty5.util.internal.PlatformDependent;
final class PooledUnsafeHeapByteBuf extends PooledHeapByteBuf {

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ByteProcessor;
import io.netty5.util.ByteProcessor;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.StringUtil;
import io.netty5.util.internal.StringUtil;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,14 +13,14 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import java.nio.ByteBuffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
/**

View File

@ -14,12 +14,12 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import io.netty.util.ResourceLeakDetector;
import io.netty.util.ResourceLeakTracker;
import io.netty5.util.ResourceLeakDetector;
import io.netty5.util.ResourceLeakTracker;
import java.nio.ByteOrder;

View File

@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import io.netty.util.ResourceLeakTracker;
import io.netty5.util.ResourceLeakTracker;
import java.nio.ByteOrder;

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static io.netty.buffer.PoolThreadCache.*;
import static io.netty5.buffer.PoolThreadCache.*;
/**
* SizeClasses requires {@code pageShifts} to be defined prior to inclusion,

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* Expose metrics for an SizeClasses.

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* A derived buffer which exposes its parent's sub-region only. It is

View File

@ -13,11 +13,11 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import io.netty.util.ByteProcessor;
import io.netty5.util.ByteProcessor;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,13 +13,13 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import io.netty.buffer.CompositeByteBuf.ByteWrapper;
import io.netty.util.CharsetUtil;
import io.netty.util.internal.PlatformDependent;
import io.netty5.buffer.CompositeByteBuf.ByteWrapper;
import io.netty5.util.CharsetUtil;
import io.netty5.util.internal.PlatformDependent;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

View File

@ -13,10 +13,10 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.StringUtil;
import io.netty5.util.internal.PlatformDependent;
import io.netty5.util.internal.StringUtil;
import java.nio.ByteBuffer;
import java.util.concurrent.atomic.LongAdder;

View File

@ -13,12 +13,12 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty5.util.internal.ObjectUtil.checkPositiveOrZero;
import static java.util.Objects.requireNonNull;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* {@link DuplicatedByteBuf} implementation that can do optimizations because it knows the duplicated buffer

View File

@ -13,12 +13,12 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import io.netty.util.internal.EmptyArrays;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.EmptyArrays;
import io.netty5.util.internal.PlatformDependent;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
/**
* A special {@link AbstractUnpooledSlicedByteBuf} that can make optimizations because it knows the sliced buffer is of

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
/**
* Big endian Java heap buffer implementation. It is recommended to use

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
import java.nio.ByteBuffer;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
import java.io.IOException;
import java.io.InputStream;
@ -24,8 +24,8 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ReadOnlyBufferException;
import static io.netty.util.internal.MathUtil.isOutOfBounds;
import static io.netty.util.internal.PlatformDependent.BIG_ENDIAN_NATIVE_ORDER;
import static io.netty5.util.internal.MathUtil.isOutOfBounds;
import static io.netty5.util.internal.PlatformDependent.BIG_ENDIAN_NATIVE_ORDER;
import static java.util.Objects.requireNonNull;
/**

View File

@ -14,9 +14,9 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
/**
* Special {@link SwappedByteBuf} for {@link ByteBuf}s that are backed by a {@code memoryAddress}.

View File

@ -14,9 +14,9 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
/**
* Special {@link SwappedByteBuf} for {@link ByteBuf}s that use unsafe to access the byte array.

View File

@ -14,12 +14,12 @@
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import static java.util.Objects.requireNonNull;
import io.netty.util.ByteProcessor;
import io.netty.util.internal.StringUtil;
import io.netty5.util.ByteProcessor;
import io.netty5.util.internal.StringUtil;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.ByteProcessor;
import io.netty5.util.ByteProcessor;
import java.io.IOException;
import java.io.InputStream;

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer;
package io.netty5.buffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.util.internal.PlatformDependent;
import java.nio.ByteBuffer;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
/**
* An object used by {@linkplain BufferAllocator buffer allocators} to communicate desirable properties of an

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import io.netty.util.internal.UnstableApi;
import io.netty5.util.internal.UnstableApi;
/**
* Methods for accessing and controlling the internals of an allocator.

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import java.nio.ByteBuffer;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
/**
* This interface is just the primitive data accessor methods that {@link Buffer} exposes.

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import io.netty.buffer.api.pool.PooledBufferAllocator;
import io.netty5.buffer.api.pool.PooledBufferAllocator;
import java.util.function.Supplier;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
/**
* An exception thrown when an operation is attempted on a {@link Buffer} when it has been closed.

View File

@ -13,10 +13,10 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import io.netty.buffer.api.internal.ResourceSupport;
import io.netty.buffer.api.internal.Statics;
import io.netty5.buffer.api.internal.ResourceSupport;
import io.netty5.buffer.api.internal.Statics;
import java.lang.invoke.VarHandle;
import java.util.Objects;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
/**
* An exception thrown when an operation is attempted on a {@linkplain Buffer#readOnly() read-only} {@link Buffer}.

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import java.lang.invoke.VarHandle;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import java.nio.ByteBuffer;

View File

@ -12,9 +12,9 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import io.netty.util.ByteProcessor;
import io.netty5.util.ByteProcessor;
/**
* The ByteCursor scans through a sequence of bytes.

View File

@ -13,10 +13,10 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import io.netty.buffer.api.internal.ResourceSupport;
import io.netty.buffer.api.internal.Statics;
import io.netty5.buffer.api.internal.ResourceSupport;
import io.netty5.buffer.api.internal.Statics;
import java.nio.ByteBuffer;
import java.nio.ReadOnlyBufferException;
@ -27,8 +27,8 @@ import java.util.Objects;
import java.util.Set;
import java.util.stream.Stream;
import static io.netty.buffer.api.internal.Statics.bufferIsClosed;
import static io.netty.buffer.api.internal.Statics.bufferIsReadOnly;
import static io.netty5.buffer.api.internal.Statics.bufferIsClosed;
import static io.netty5.buffer.api.internal.Statics.bufferIsReadOnly;
import static java.lang.Math.addExact;
/**

View File

@ -12,22 +12,22 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.SystemPropertyUtil;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty5.util.internal.PlatformDependent;
import io.netty5.util.internal.SystemPropertyUtil;
import io.netty5.util.internal.logging.InternalLogger;
import io.netty5.util.internal.logging.InternalLoggerFactory;
import java.util.Locale;
import java.util.function.Supplier;
import static io.netty.buffer.api.BufferAllocator.offHeapPooled;
import static io.netty.buffer.api.BufferAllocator.offHeapUnpooled;
import static io.netty.buffer.api.BufferAllocator.onHeapPooled;
import static io.netty.buffer.api.BufferAllocator.onHeapUnpooled;
import static io.netty.util.internal.ObjectUtil.checkNotNullWithIAE;
import static io.netty.util.internal.PlatformDependent.directBufferPreferred;
import static io.netty5.buffer.api.BufferAllocator.offHeapPooled;
import static io.netty5.buffer.api.BufferAllocator.offHeapUnpooled;
import static io.netty5.buffer.api.BufferAllocator.onHeapPooled;
import static io.netty5.buffer.api.BufferAllocator.onHeapUnpooled;
import static io.netty5.util.internal.ObjectUtil.checkNotNullWithIAE;
import static io.netty5.util.internal.PlatformDependent.directBufferPreferred;
import static java.lang.Runtime.getRuntime;
/**

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
/**
* An interface used by {@link Resource} instances to implement their resource disposal mechanics.

View File

@ -13,14 +13,14 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import io.netty.buffer.api.internal.Statics;
import io.netty5.buffer.api.internal.Statics;
import java.util.function.Supplier;
import static io.netty.buffer.api.internal.Statics.NO_OP_DROP;
import static io.netty.buffer.api.internal.Statics.allocatorClosedException;
import static io.netty5.buffer.api.internal.Statics.NO_OP_DROP;
import static io.netty5.buffer.api.internal.Statics.allocatorClosedException;
class ManagedBufferAllocator implements BufferAllocator, AllocatorControl {
private final MemoryManager manager;

View File

@ -13,13 +13,13 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import io.netty.buffer.api.internal.MemoryManagerLoader;
import io.netty.buffer.api.internal.MemoryManagerOverride;
import io.netty.util.internal.UnstableApi;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.netty5.buffer.api.internal.MemoryManagerLoader;
import io.netty5.buffer.api.internal.MemoryManagerOverride;
import io.netty5.util.internal.UnstableApi;
import io.netty5.util.internal.logging.InternalLogger;
import io.netty5.util.internal.logging.InternalLoggerFactory;
import java.lang.ref.Cleaner;
import java.util.Optional;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
/**
* This interface encapsulates the ownership of a {@link Resource}, and exposes a method that may be used to transfer

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import java.nio.ByteBuffer;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import java.nio.ByteBuffer;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
/**
* A resource that has a life-time, and can be {@linkplain #close() closed}.

View File

@ -13,9 +13,9 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import io.netty.buffer.api.internal.SendFromSupplier;
import io.netty5.buffer.api.internal.SendFromSupplier;
import java.util.function.Function;
import java.util.function.Supplier;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
/**
* Standard implementations of {@link AllocationType} that all {@linkplain MemoryManager memory managers} should

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import java.nio.ByteBuffer;

View File

@ -13,7 +13,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api;
package io.netty5.buffer.api;
import java.nio.ByteBuffer;

View File

@ -13,13 +13,14 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api.adaptor;
package io.netty5.buffer.api.adaptor;
import io.netty.buffer.ByteBufConvertible;
import io.netty.util.ReferenceCounted;
import io.netty5.buffer.ByteBufConvertible;
import io.netty5.util.ReferenceCounted;
import io.netty5.buffer.ByteBuf;
/**
* Interfaces that are required for an object to stand-in for a {@link io.netty.buffer.ByteBuf} in Netty.
* Interfaces that are required for an object to stand-in for a {@link ByteBuf} in Netty.
*/
public interface BufferIntegratable extends ByteBufConvertible, ReferenceCounted {
}

View File

@ -13,22 +13,22 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api.adaptor;
package io.netty5.buffer.api.adaptor;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.ByteBufConvertible;
import io.netty.buffer.ByteBufUtil;
import io.netty.buffer.DuplicatedByteBuf;
import io.netty.buffer.SlicedByteBuf;
import io.netty.buffer.SwappedByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.buffer.api.Buffer;
import io.netty.buffer.api.BufferAllocator;
import io.netty.buffer.api.internal.ResourceSupport;
import io.netty.buffer.api.internal.Statics;
import io.netty.util.ByteProcessor;
import io.netty.util.IllegalReferenceCountException;
import io.netty5.buffer.ByteBuf;
import io.netty5.buffer.ByteBufAllocator;
import io.netty5.buffer.ByteBufConvertible;
import io.netty5.buffer.ByteBufUtil;
import io.netty5.buffer.DuplicatedByteBuf;
import io.netty5.buffer.SlicedByteBuf;
import io.netty5.buffer.SwappedByteBuf;
import io.netty5.buffer.Unpooled;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.internal.ResourceSupport;
import io.netty5.buffer.api.internal.Statics;
import io.netty5.util.ByteProcessor;
import io.netty5.util.IllegalReferenceCountException;
import java.io.IOException;
import java.io.InputStream;
@ -42,9 +42,6 @@ import java.nio.charset.Charset;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicReference;
import static io.netty.buffer.api.internal.Statics.acquire;
import static io.netty.buffer.api.internal.Statics.isOwned;
public final class ByteBufAdaptor extends ByteBuf {
private final ByteBufAllocatorAdaptor alloc;
private final Buffer buffer;
@ -114,7 +111,7 @@ public final class ByteBufAdaptor extends ByteBuf {
try {
buffer.ensureWritable(diff);
} catch (IllegalStateException e) {
if (!isOwned((ResourceSupport<?, ?>) buffer)) {
if (!Statics.isOwned((ResourceSupport<?, ?>) buffer)) {
throw new UnsupportedOperationException(e);
}
throw e;
@ -261,7 +258,7 @@ public final class ByteBufAdaptor extends ByteBuf {
return 1;
}
try {
if (isOwned((ResourceSupport<?, ?>) buffer)) {
if (Statics.isOwned((ResourceSupport<?, ?>) buffer)) {
// Good place.
buffer.ensureWritable(minWritableBytes);
} else {
@ -1601,7 +1598,7 @@ public final class ByteBufAdaptor extends ByteBuf {
@Override
public ByteBuf retain(int increment) {
for (int i = 0; i < increment; i++) {
acquire((ResourceSupport<?, ?>) buffer);
Statics.acquire((ResourceSupport<?, ?>) buffer);
}
return this;
}
@ -1619,7 +1616,7 @@ public final class ByteBufAdaptor extends ByteBuf {
var rc = (ResourceSupport<?, ?>) buffer;
return Statics.countBorrows(rc);
}
return isOwned((ResourceSupport<?, ?>) buffer)? 0 : 1;
return Statics.isOwned((ResourceSupport<?, ?>) buffer)? 0 : 1;
}
@Override

View File

@ -13,17 +13,18 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api.adaptor;
package io.netty5.buffer.api.adaptor;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.CompositeByteBuf;
import io.netty.buffer.api.Buffer;
import io.netty.buffer.api.BufferAllocator;
import io.netty.buffer.api.internal.AdaptableBuffer;
import io.netty.util.internal.PlatformDependent;
import io.netty5.buffer.ByteBuf;
import io.netty5.buffer.ByteBufAllocator;
import io.netty5.buffer.CompositeByteBuf;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.internal.AdaptableBuffer;
import io.netty5.util.internal.PlatformDependent;
import static io.netty5.util.internal.ObjectUtil.checkPositiveOrZero;
import static io.netty.util.internal.ObjectUtil.checkPositiveOrZero;
import java.util.Objects;
public class ByteBufAllocatorAdaptor implements ByteBufAllocator, AutoCloseable {

View File

@ -15,6 +15,6 @@
*/
/**
* Helpers for integrating with the existing {@link io.netty.buffer.ByteBuf} API.
* Helpers for integrating with the existing {@link io.netty5.buffer.ByteBuf} API.
*/
package io.netty.buffer.api.adaptor;
package io.netty5.buffer.api.adaptor;

View File

@ -13,22 +13,19 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api.bytebuffer;
package io.netty5.buffer.api.bytebuffer;
import io.netty.buffer.api.AllocationType;
import io.netty.buffer.api.AllocatorControl;
import io.netty.buffer.api.Buffer;
import io.netty.buffer.api.Drop;
import io.netty.buffer.api.MemoryManager;
import io.netty.buffer.api.StandardAllocationTypes;
import io.netty.buffer.api.internal.Statics;
import io.netty5.buffer.api.AllocationType;
import io.netty5.buffer.api.AllocatorControl;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.Drop;
import io.netty5.buffer.api.MemoryManager;
import io.netty5.buffer.api.StandardAllocationTypes;
import io.netty5.buffer.api.internal.Statics;
import java.lang.ref.Cleaner;
import java.nio.ByteBuffer;
import static io.netty.buffer.api.internal.Statics.bbslice;
import static io.netty.buffer.api.internal.Statics.convert;
public class ByteBufferMemoryManager implements MemoryManager {
@Override
public Buffer allocateShared(AllocatorControl allocatorControl, long size, Drop<Buffer> drop, Cleaner cleaner,
@ -42,7 +39,7 @@ public class ByteBufferMemoryManager implements MemoryManager {
} else {
throw new IllegalArgumentException("Unknown allocation type: " + allocationType);
}
return new NioBuffer(buffer, buffer, allocatorControl, convert(drop));
return new NioBuffer(buffer, buffer, allocatorControl, Statics.convert(drop));
}
@Override
@ -65,13 +62,13 @@ public class ByteBufferMemoryManager implements MemoryManager {
@Override
public Buffer recoverMemory(AllocatorControl allocatorControl, Object recoverableMemory, Drop<Buffer> drop) {
ByteBuffer memory = (ByteBuffer) recoverableMemory;
return new NioBuffer(memory, memory, allocatorControl, convert(drop));
return new NioBuffer(memory, memory, allocatorControl, Statics.convert(drop));
}
@Override
public Object sliceMemory(Object memory, int offset, int length) {
var buffer = (ByteBuffer) memory;
return bbslice(buffer, offset, length);
return Statics.bbslice(buffer, offset, length);
}
@Override

View File

@ -13,33 +13,28 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
package io.netty.buffer.api.bytebuffer;
package io.netty5.buffer.api.bytebuffer;
import io.netty.buffer.api.AllocatorControl;
import io.netty.buffer.api.Buffer;
import io.netty.buffer.api.BufferAllocator;
import io.netty.buffer.api.BufferReadOnlyException;
import io.netty.buffer.api.ByteCursor;
import io.netty.buffer.api.Drop;
import io.netty.buffer.api.Owned;
import io.netty.buffer.api.ReadableComponent;
import io.netty.buffer.api.ReadableComponentProcessor;
import io.netty.buffer.api.WritableComponent;
import io.netty.buffer.api.WritableComponentProcessor;
import io.netty.buffer.api.internal.AdaptableBuffer;
import io.netty.buffer.api.internal.ArcDrop;
import io.netty.buffer.api.internal.Statics;
import io.netty.util.internal.PlatformDependent;
import io.netty5.buffer.api.AllocatorControl;
import io.netty5.buffer.api.Buffer;
import io.netty5.buffer.api.BufferAllocator;
import io.netty5.buffer.api.BufferReadOnlyException;
import io.netty5.buffer.api.ByteCursor;
import io.netty5.buffer.api.Drop;
import io.netty5.buffer.api.Owned;
import io.netty5.buffer.api.ReadableComponent;
import io.netty5.buffer.api.ReadableComponentProcessor;
import io.netty5.buffer.api.WritableComponent;
import io.netty5.buffer.api.WritableComponentProcessor;
import io.netty5.buffer.api.internal.AdaptableBuffer;
import io.netty5.buffer.api.internal.ArcDrop;
import io.netty5.buffer.api.internal.Statics;
import io.netty5.util.internal.PlatformDependent;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.ReadOnlyBufferException;
import static io.netty.buffer.api.internal.Statics.bbput;
import static io.netty.buffer.api.internal.Statics.bbslice;
import static io.netty.buffer.api.internal.Statics.bufferIsClosed;
import static io.netty.buffer.api.internal.Statics.bufferIsReadOnly;
class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent, WritableComponent {
private static final ByteBuffer CLOSED_BUFFER = ByteBuffer.allocate(0);
@ -67,7 +62,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
super(new MakeInaccessibleOnDrop(new ArcDrop<>(ArcDrop.acquire(parent.unsafeGetDrop()))));
control = parent.control;
base = parent.base;
rmem = bbslice(parent.rmem, 0, parent.rmem.capacity()); // Need to slice to get independent byte orders.
rmem = Statics.bbslice(parent.rmem, 0, parent.rmem.capacity()); // Need to slice to get independent byte orders.
assert parent.wmem == CLOSED_BUFFER;
wmem = CLOSED_BUFFER;
roff = parent.roff;
@ -120,7 +115,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
@Override
protected RuntimeException createResourceClosedException() {
return bufferIsClosed(this);
return Statics.bufferIsClosed(this);
}
@Override
@ -157,7 +152,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
int capacity = capacity();
checkSet(0, capacity);
if (rmem == CLOSED_BUFFER) {
throw bufferIsClosed(this);
throw Statics.bufferIsClosed(this);
}
for (int i = 0; i < capacity; i++) {
wmem.put(i, value);
@ -187,7 +182,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
int allocSize = Math.max(length, 1); // Allocators don't support allocating zero-sized buffers.
AllocatorControl.UntetheredMemory memory = control.allocateUntethered(this, allocSize);
ByteBuffer base = memory.memory();
ByteBuffer buffer = length == 0? bbslice(base, 0, 0) : base;
ByteBuffer buffer = length == 0? Statics.bbslice(base, 0, 0) : base;
Buffer copy = new NioBuffer(base, buffer, control, memory.drop());
copyInto(offset, copy, 0, length);
copy.writerOffset(length);
@ -202,7 +197,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
@Override
public void copyInto(int srcPos, ByteBuffer dest, int destPos, int length) {
if (rmem == CLOSED_BUFFER) {
throw bufferIsClosed(this);
throw Statics.bufferIsClosed(this);
}
if (srcPos < 0) {
throw new IllegalArgumentException("The srcPos cannot be negative: " + srcPos + '.');
@ -215,13 +210,13 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
"srcPos = " + srcPos + ", length = " + length + '.');
}
dest = dest.duplicate().clear();
bbput(dest, destPos, rmem, srcPos, length);
Statics.bbput(dest, destPos, rmem, srcPos, length);
}
@Override
public void copyInto(int srcPos, Buffer dest, int destPos, int length) {
if (dest.readOnly()) {
throw bufferIsReadOnly(dest);
throw Statics.bufferIsReadOnly(dest);
}
if (dest instanceof NioBuffer) {
var nb = (NioBuffer) dest;
@ -241,7 +236,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
@Override
public ByteCursor openCursor(int fromOffset, int length) {
if (rmem == CLOSED_BUFFER) {
throw bufferIsClosed(this);
throw Statics.bufferIsClosed(this);
}
if (fromOffset < 0) {
throw new IllegalArgumentException("The fromOffset cannot be negative: " + fromOffset + '.');
@ -290,7 +285,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
@Override
public ByteCursor openReverseCursor(int fromOffset, int length) {
if (rmem == CLOSED_BUFFER) {
throw bufferIsClosed(this);
throw Statics.bufferIsClosed(this);
}
if (fromOffset < 0) {
throw new IllegalArgumentException("The fromOffset cannot be negative: " + fromOffset + '.');
@ -341,7 +336,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
@Override
public Buffer ensureWritable(int size, int minimumGrowth, boolean allowCompaction) {
if (!isAccessible()) {
throw bufferIsClosed(this);
throw Statics.bufferIsClosed(this);
}
if (!isOwned()) {
throw attachTrace(new IllegalStateException(
@ -354,7 +349,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
throw new IllegalArgumentException("The minimum growth cannot be negative: " + minimumGrowth + '.');
}
if (rmem != wmem) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
if (writableBytes() >= size) {
// We already have enough space.
@ -410,14 +405,14 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
"but the split offset was " + splitOffset + ", and capacity is " + capacity() + '.');
}
if (!isAccessible()) {
throw attachTrace(bufferIsClosed(this));
throw attachTrace(Statics.bufferIsClosed(this));
}
if (!isOwned()) {
throw attachTrace(new IllegalStateException("Cannot split a buffer that is not owned."));
}
var drop = (ArcDrop<NioBuffer>) unsafeGetDrop();
unsafeSetDrop(new ArcDrop<>(drop));
var splitByteBuffer = bbslice(rmem, 0, splitOffset);
var splitByteBuffer = Statics.bbslice(rmem, 0, splitOffset);
// TODO maybe incrementing the existing ArcDrop is enough; maybe we don't need to wrap it in another ArcDrop.
var splitBuffer = new NioBuffer(base, splitByteBuffer, control, new ArcDrop<>(drop.increment()));
splitBuffer.woff = Math.min(woff, splitOffset);
@ -428,7 +423,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
}
// Split preserves const-state.
splitBuffer.constBuffer = constBuffer;
rmem = bbslice(rmem, splitOffset, rmem.capacity() - splitOffset);
rmem = Statics.bbslice(rmem, splitOffset, rmem.capacity() - splitOffset);
if (!readOnly) {
wmem = rmem;
}
@ -497,7 +492,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
@Override
public ByteBuffer readableBuffer() {
return bbslice(rmem.asReadOnlyBuffer(), readerOffset(), readableBytes());
return Statics.bbslice(rmem.asReadOnlyBuffer(), readerOffset(), readableBytes());
}
@Override
@ -527,7 +522,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
@Override
public ByteBuffer writableBuffer() {
return bbslice(wmem, writerOffset(), writableBytes());
return Statics.bbslice(wmem, writerOffset(), writableBytes());
}
// </editor-fold>
@ -579,7 +574,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -591,7 +586,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -604,7 +599,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -616,7 +611,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -643,7 +638,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -655,7 +650,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -696,7 +691,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -708,7 +703,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -721,7 +716,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -733,7 +728,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -840,7 +835,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -852,7 +847,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, this.woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -865,7 +860,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -877,7 +872,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, this.woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -904,7 +899,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -916,7 +911,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -943,7 +938,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -955,7 +950,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -982,7 +977,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
@ -994,7 +989,7 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
} catch (IndexOutOfBoundsException e) {
throw checkWriteState(e, woff);
} catch (ReadOnlyBufferException e) {
throw bufferIsReadOnly(this);
throw Statics.bufferIsReadOnly(this);
}
}
// </editor-fold>
@ -1067,10 +1062,10 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
private RuntimeException checkWriteState(IndexOutOfBoundsException ioobe, int offset) {
if (rmem == CLOSED_BUFFER) {
return bufferIsClosed(this);
return Statics.bufferIsClosed(this);
}
if (wmem != rmem) {
return bufferIsReadOnly(this);
return Statics.bufferIsReadOnly(this);
}
IndexOutOfBoundsException exception = outOfBounds(offset);
@ -1080,17 +1075,17 @@ class NioBuffer extends AdaptableBuffer<NioBuffer> implements ReadableComponent,
private RuntimeException readAccessCheckException(int index) {
if (rmem == CLOSED_BUFFER) {
throw bufferIsClosed(this);
throw Statics.bufferIsClosed(this);
}
return outOfBounds(index);
}
private RuntimeException writeAccessCheckException(int index) {
if (rmem == CLOSED_BUFFER) {
throw bufferIsClosed(this);
throw Statics.bufferIsClosed(this);
}
if (wmem != rmem) {
return bufferIsReadOnly(this);
return Statics.bufferIsReadOnly(this);
}
return outOfBounds(index);
}

Some files were not shown because too many files have changed in this diff Show More