Package com.velocitypowered.natives.util
Class MoreByteBufUtils
java.lang.Object
com.velocitypowered.natives.util.MoreByteBufUtils
Additional utilities for
ByteBuf.-
Method Summary
Modifier and TypeMethodDescriptionstatic io.netty.buffer.ByteBufensureCompatible(io.netty.buffer.ByteBufAllocator alloc, Native nativeStuff, io.netty.buffer.ByteBuf buf) Ensures thebufwill work with the specifiednativeStuff.static io.netty.buffer.ByteBufpreferredBuffer(io.netty.buffer.ByteBufAllocator alloc, Native nativeStuff, int initialCapacity) Creates aByteBufthat will have the best performance with the specifiednativeStuff.
-
Method Details
-
ensureCompatible
public static io.netty.buffer.ByteBuf ensureCompatible(io.netty.buffer.ByteBufAllocator alloc, Native nativeStuff, io.netty.buffer.ByteBuf buf) Ensures thebufwill work with the specifiednativeStuff. After this function is called, you should decrement the reference count on thebufwithReferenceCounted.release().- Parameters:
alloc- theByteBufAllocatorto usenativeStuff- the native we are working withbuf- 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 aByteBufthat will have the best performance with the specifiednativeStuff.- Parameters:
alloc- theByteBufAllocatorto usenativeStuff- the native we are working withinitialCapacity- the initial capacity to allocate- Returns:
- a buffer compatible with the native
-