Class MoreByteBufUtils

java.lang.Object
com.velocitypowered.natives.util.MoreByteBufUtils

public class MoreByteBufUtils extends Object
Additional utilities for ByteBuf.
  • Method Summary

    Modifier and Type
    Method
    Description
    static io.netty.buffer.ByteBuf
    ensureCompatible(io.netty.buffer.ByteBufAllocator alloc, Native nativeStuff, io.netty.buffer.ByteBuf buf)
    Ensures the buf will work with the specified nativeStuff.
    static io.netty.buffer.ByteBuf
    preferredBuffer(io.netty.buffer.ByteBufAllocator alloc, Native nativeStuff, int initialCapacity)
    Creates a ByteBuf that will have the best performance with the specified nativeStuff.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • ensureCompatible

      public static io.netty.buffer.ByteBuf ensureCompatible(io.netty.buffer.ByteBufAllocator alloc, Native nativeStuff, io.netty.buffer.ByteBuf buf)
      Ensures the buf will work with the specified nativeStuff. After this function is called, you should decrement the reference count on the buf with ReferenceCounted.release().
      Parameters:
      alloc - the ByteBufAllocator to use
      nativeStuff - the native we are working with
      buf - the buffer we are working with
      Returns:
      a buffer compatible with the native
    • preferredBuffer

      public static io.netty.buffer.ByteBuf preferredBuffer(io.netty.buffer.ByteBufAllocator alloc, Native nativeStuff, int initialCapacity)
      Creates a ByteBuf that will have the best performance with the specified nativeStuff.
      Parameters:
      alloc - the ByteBufAllocator to use
      nativeStuff - the native we are working with
      initialCapacity - the initial capacity to allocate
      Returns:
      a buffer compatible with the native