Package net.minestom.server.utils.binary
Class BinaryBuffer
java.lang.Object
net.minestom.server.utils.binary.BinaryBuffer
Manages off-heap memory.
Not thread-safe.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionasByteBuffer
(int reader, int length) boolean
canRead
(int size) boolean
canWrite
(int size) int
capacity()
clear()
static BinaryBuffer
copy
(BinaryBuffer buffer) @NotNull BinaryBuffer.Marker
mark()
static BinaryBuffer
ofSize
(int size) int
byte[]
readBytes
(int length) void
readChannel
(ReadableByteChannel channel) int
void
readerOffset
(int offset) byte[]
int
void
reset
(int readerOffset, int writerOffset) void
reset
(@NotNull BinaryBuffer.Marker marker) toString()
static BinaryBuffer
wrap
(ByteBuffer buffer) void
write
(ByteBuffer buffer) void
write
(ByteBuffer buffer, int index, int length) void
write
(BinaryBuffer buffer) void
writeBytes
(byte[] bytes) boolean
writeChannel
(WritableByteChannel channel) int
void
writerOffset
(int offset)
-
Method Details
-
ofSize
-
wrap
-
copy
-
write
-
write
-
write
-
readVarInt
public int readVarInt() -
mark
-
reset
public void reset(int readerOffset, int writerOffset) -
reset
-
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
-
asByteBuffer
-
asByteBuffer
-
writeChannel
- Throws:
IOException
-
readChannel
- Throws:
IOException
-
toString
-