Class BinaryBuffer

java.lang.Object
net.minestom.server.utils.binary.BinaryBuffer

@Internal public final class BinaryBuffer extends Object
Manages off-heap memory. Not thread-safe.
  • Method Details

    • ofSize

      @Internal public static BinaryBuffer ofSize(int size)
    • wrap

      @Internal public static BinaryBuffer wrap(ByteBuffer buffer)
    • copy

      public static BinaryBuffer copy(BinaryBuffer buffer)
    • write

      public void write(ByteBuffer buffer, int index, int length)
    • write

      public void write(ByteBuffer buffer)
    • write

      public void write(BinaryBuffer buffer)
    • readVarInt

      public int readVarInt()
    • mark

      @NotNull public @NotNull BinaryBuffer.Marker mark()
    • reset

      public void reset(int readerOffset, int writerOffset)
    • reset

      public void reset(@NotNull @NotNull BinaryBuffer.Marker marker)
    • canRead

      public boolean canRead(int size)
    • canWrite

      public boolean canWrite(int size)
    • capacity

      public int capacity()
    • readerOffset

      public int readerOffset()
    • readerOffset

      public void readerOffset(int offset)
    • writerOffset

      public int writerOffset()
    • writerOffset

      public void writerOffset(int offset)
    • readableBytes

      public int readableBytes()
    • writeBytes

      public void writeBytes(byte[] bytes)
    • readBytes

      public byte[] readBytes(int length)
    • readRemainingBytes

      public byte[] readRemainingBytes()
    • clear

      public BinaryBuffer clear()
    • asByteBuffer

      public ByteBuffer asByteBuffer(int reader, int length)
    • asByteBuffer

      @Internal public ByteBuffer asByteBuffer()
    • writeChannel

      public boolean writeChannel(WritableByteChannel channel) throws IOException
      Throws:
      IOException
    • readChannel

      public void readChannel(ReadableByteChannel channel) throws IOException
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object