Package net.minestom.server.network
Interface NetworkBuffer
public sealed interface NetworkBuffer
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NetworkBuffer.Type<BitSet> static final NetworkBuffer.Type<Point> static final NetworkBuffer.Type<Boolean> static final NetworkBuffer.Type<Byte> static final NetworkBuffer.Type<byte[]> static final NetworkBuffer.Type<Component> static final NetworkBuffer.Type<Direction> static final NetworkBuffer.Type<Double> static final NetworkBuffer.Type<Float> static final NetworkBuffer.Type<Instant> static final NetworkBuffer.Type<Integer> static final NetworkBuffer.Type<Component> static final NetworkBuffer.Type<net.kyori.adventure.key.Key> static final NetworkBuffer.Type<Long> static final NetworkBuffer.Type<long[]> static final NetworkBuffer.Type<net.kyori.adventure.nbt.BinaryTag> static final NetworkBuffer.Type<net.kyori.adventure.nbt.CompoundBinaryTag> static final NetworkBuffer.Type<@Nullable Point> static final NetworkBuffer.Type<@Nullable Component> static final NetworkBuffer.Type<@Nullable UUID> static final NetworkBuffer.Type<@Nullable Integer> static final NetworkBuffer.Type<Pos> static final NetworkBuffer.Type<EntityPose> static final NetworkBuffer.Type<PublicKey> static final NetworkBuffer.Type<float[]> static final NetworkBuffer.Type<byte[]> static final NetworkBuffer.Type<Short> static final NetworkBuffer.Type<String> static final NetworkBuffer.Type<String> static final NetworkBuffer.Type<String> static final NetworkBuffer.Type<Unit> static final NetworkBuffer.Type<Integer> static final NetworkBuffer.Type<UUID> static final NetworkBuffer.Type<Integer> static final NetworkBuffer.Type<Integer> static final NetworkBuffer.Type<int[]> static final NetworkBuffer.Type<Long> static final NetworkBuffer.Type<long[]> static final NetworkBuffer.Type<Point> static final NetworkBuffer.Type<Point> static final NetworkBuffer.Type<Point> static final NetworkBuffer.Type<Point> -
Method Summary
Modifier and TypeMethodDescriptionlongadvanceRead(long length) longadvanceWrite(long length) static @NotNull NetworkBuffer.Builderbuilder(long size) longcapacity()void@NotNull NetworkBufferclear()voidcompact()longcompress(long start, long length, NetworkBuffer output) default NetworkBuffercopy(long index, long length) copy(long index, long length, long readIndex, long writeIndex) static voidcopy(NetworkBuffer srcBuffer, long srcOffset, NetworkBuffer dstBuffer, long dstOffset, long length) voidcopyTo(long srcOffset, byte @NotNull [] dest, long destOffset, long length) longdecompress(long start, long length, NetworkBuffer output) static <L,R> @NotNull NetworkBuffer.Type <Either<L, R>> Either(NetworkBuffer.Type<L> left, NetworkBuffer.Type<R> right) voidensureWritable(long length) static <E extends Enum<E>>
@NotNull NetworkBuffer.Type<E> static <E extends Enum<E>>
@NotNull NetworkBuffer.Type<EnumSet<E>> static booleanequals(NetworkBuffer buffer1, NetworkBuffer buffer2) byte @NotNull []extractBytes(@NotNull Consumer<@NotNull NetworkBuffer> extractor) static @NotNull NetworkBuffer.Type<BitSet> FixedBitSet(int length) static @NotNull NetworkBuffer.Type<byte[]> FixedRawBytes(int length) @NotNull NetworkBufferindex(long readIndex, long writeIndex) booleanstatic <T> @NotNull NetworkBuffer.Type<T> Lazy(@NotNull Supplier<@NotNull NetworkBuffer.Type<T>> supplier) static byte[]makeArray(@NotNull Consumer<@NotNull NetworkBuffer> writing) static byte[]makeArray(@NotNull Consumer<@NotNull NetworkBuffer> writing, @Nullable Registries registries) static <T> byte[]makeArray(@NotNull NetworkBuffer.Type<T> type, T value) static <T> byte[]makeArray(@NotNull NetworkBuffer.Type<T> type, T value, @Nullable Registries registries) <T> @UnknownNullability Tread(@NotNull NetworkBuffer.Type<T> type) long<T> @UnknownNullability TreadAt(long index, @NotNull NetworkBuffer.Type<T> type) intreadChannel(ReadableByteChannel channel) long@NotNull NetworkBufferreadIndex(long readIndex) voidreadOnly()@Nullable Registriesstatic @NotNull NetworkBufferstatic @NotNull NetworkBufferresizableBuffer(int initialSize) static @NotNull NetworkBufferresizableBuffer(long initialSize, Registries registries) static @NotNull NetworkBufferresizableBuffer(Registries registries) voidresize(long newSize) static @NotNull NetworkBufferstaticBuffer(long size) static @NotNull NetworkBufferstaticBuffer(long size, Registries registries) static <T> @NotNull NetworkBuffer.Type<T> static @NotNull NetworkBufferwrap(byte @NotNull [] bytes, int readIndex, int writeIndex) static @NotNull NetworkBufferwrap(byte @NotNull [] bytes, int readIndex, int writeIndex, @Nullable Registries registries) long<T> voidwrite(@NotNull NetworkBuffer.Type<T> type, @UnknownNullability T value) <T> voidwriteAt(long index, @NotNull NetworkBuffer.Type<T> type, @UnknownNullability T value) booleanwriteChannel(SocketChannel channel) long@NotNull NetworkBufferwriteIndex(long writeIndex)
-
Field Details
-
UNIT
-
BOOLEAN
-
BYTE
-
SHORT
-
UNSIGNED_SHORT
-
INT
-
LONG
-
FLOAT
-
DOUBLE
-
VAR_INT
-
OPTIONAL_VAR_INT
-
VAR_INT_3
-
VAR_LONG
-
RAW_BYTES
-
STRING
-
KEY
-
STRING_TERMINATED
-
STRING_IO_UTF8
-
NBT
-
NBT_COMPOUND
-
BLOCK_POSITION
-
COMPONENT
-
JSON_COMPONENT
-
UUID
-
POS
-
BYTE_ARRAY
-
LONG_ARRAY
-
VAR_INT_ARRAY
-
VAR_LONG_ARRAY
-
BITSET
-
INSTANT_MS
-
PUBLIC_KEY
-
VECTOR3
-
VECTOR3D
-
VECTOR3I
-
VECTOR3B
-
QUATERNION
-
OPT_CHAT
-
OPT_BLOCK_POSITION
-
OPT_UUID
-
DIRECTION
-
POSE
-
-
Method Details
-
Enum
@NotNull static <E extends Enum<E>> @NotNull NetworkBuffer.Type<E> Enum(@NotNull @NotNull Class<E> enumClass) -
EnumSet
@NotNull static <E extends Enum<E>> @NotNull NetworkBuffer.Type<EnumSet<E>> EnumSet(@NotNull @NotNull Class<E> enumClass) -
FixedBitSet
-
FixedRawBytes
-
Lazy
@NotNull static <T> @NotNull NetworkBuffer.Type<T> Lazy(@NotNull @NotNull Supplier<@NotNull NetworkBuffer.Type<T>> supplier) -
TypedNBT
-
Either
@NotNull static <L,R> @NotNull NetworkBuffer.Type<Either<L,R>> Either(@NotNull NetworkBuffer.Type<L> left, @NotNull NetworkBuffer.Type<R> right) -
write
<T> void write(@NotNull @NotNull NetworkBuffer.Type<T> type, @UnknownNullability T value) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
read
<T> @UnknownNullability T read(@NotNull @NotNull NetworkBuffer.Type<T> type) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
writeAt
<T> void writeAt(long index, @NotNull @NotNull NetworkBuffer.Type<T> type, @UnknownNullability T value) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
readAt
<T> @UnknownNullability T readAt(long index, @NotNull @NotNull NetworkBuffer.Type<T> type) throws IndexOutOfBoundsException - Throws:
IndexOutOfBoundsException
-
copyTo
void copyTo(long srcOffset, byte @NotNull [] dest, long destOffset, long length) -
extractBytes
-
clear
-
writeIndex
long writeIndex() -
readIndex
long readIndex() -
writeIndex
-
readIndex
-
index
-
advanceWrite
long advanceWrite(long length) -
advanceRead
long advanceRead(long length) -
readableBytes
long readableBytes() -
writableBytes
long writableBytes() -
capacity
long capacity() -
readOnly
void readOnly() -
isReadOnly
boolean isReadOnly() -
resize
void resize(long newSize) -
ensureWritable
void ensureWritable(long length) -
compact
void compact() -
copy
-
copy
-
readChannel
- Throws:
IOException
-
writeChannel
- Throws:
IOException
-
cipher
-
compress
-
decompress
- Throws:
DataFormatException
-
registries
-
builder
-
staticBuffer
-
staticBuffer
-
resizableBuffer
-
resizableBuffer
-
resizableBuffer
-
resizableBuffer
-
wrap
@NotNull static @NotNull NetworkBuffer wrap(byte @NotNull [] bytes, int readIndex, int writeIndex, @Nullable @Nullable Registries registries) -
wrap
-
makeArray
static byte[] makeArray(@NotNull @NotNull Consumer<@NotNull NetworkBuffer> writing, @Nullable @Nullable Registries registries) -
makeArray
-
makeArray
static <T> byte[] makeArray(@NotNull @NotNull NetworkBuffer.Type<T> type, @NotNull T value, @Nullable @Nullable Registries registries) -
makeArray
-
copy
static void copy(NetworkBuffer srcBuffer, long srcOffset, NetworkBuffer dstBuffer, long dstOffset, long length) -
equals
-