Package net.minestom.server.network
Interface NetworkBuffer
public sealed interface NetworkBuffer
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
static interface
static interface
-
Field Summary
Modifier 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
<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
<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
<int[]> -
Method Summary
Modifier and TypeMethodDescriptionlong
advanceRead
(long length) long
advanceWrite
(long length) static @NotNull NetworkBuffer.Builder
builder
(long size) long
capacity()
void
@NotNull NetworkBuffer
clear()
void
compact()
long
compress
(long start, long length, NetworkBuffer output) default NetworkBuffer
copy
(long index, long length) copy
(long index, long length, long readIndex, long writeIndex) static void
copy
(NetworkBuffer srcBuffer, long srcOffset, NetworkBuffer dstBuffer, long dstOffset, long length) void
copyTo
(long srcOffset, byte @NotNull [] dest, long destOffset, long length) long
decompress
(long start, long length, NetworkBuffer output) void
ensureWritable
(long length) static <E extends Enum<E>>
@NotNull NetworkBuffer.Type<E> static <E extends Enum<E>>
@NotNull NetworkBuffer.Type<EnumSet<E>> static boolean
equals
(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 NetworkBuffer
index
(long readIndex, long writeIndex) boolean
static <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 T
read
(@NotNull NetworkBuffer.Type<T> type) long
<T> @UnknownNullability T
readAt
(long index, @NotNull NetworkBuffer.Type<T> type) int
readChannel
(ReadableByteChannel channel) long
@NotNull NetworkBuffer
readIndex
(long readIndex) void
readOnly()
@Nullable Registries
static <T extends ProtocolObject>
@NotNull NetworkBuffer.Type<DynamicRegistry.Key<T>> RegistryKey
(@NotNull Function<Registries, DynamicRegistry<T>> selector) static @NotNull NetworkBuffer
static @NotNull NetworkBuffer
resizableBuffer
(int initialSize) static @NotNull NetworkBuffer
resizableBuffer
(long initialSize, Registries registries) static @NotNull NetworkBuffer
resizableBuffer
(Registries registries) void
resize
(long newSize) static @NotNull NetworkBuffer
staticBuffer
(long size) static @NotNull NetworkBuffer
staticBuffer
(long size, Registries registries) static @NotNull NetworkBuffer
wrap
(byte @NotNull [] bytes, int readIndex, int writeIndex) static @NotNull NetworkBuffer
wrap
(byte @NotNull [] bytes, int readIndex, int writeIndex, @Nullable Registries registries) long
<T> void
write
(@NotNull NetworkBuffer.Type<T> type, @UnknownNullability T value) <T> void
writeAt
(long index, @NotNull NetworkBuffer.Type<T> type, @UnknownNullability T value) boolean
writeChannel
(SocketChannel channel) long
@NotNull NetworkBuffer
writeIndex
(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
-
STRING_TERMINATED
-
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
-
VILLAGER_DATA
-
VECTOR3
-
VECTOR3D
-
VECTOR3B
-
QUATERNION
-
OPT_CHAT
-
OPT_BLOCK_POSITION
-
OPT_UUID
-
DIRECTION
-
POSE
-
-
Method Details
-
RegistryKey
@NotNull static <T extends ProtocolObject> @NotNull NetworkBuffer.Type<DynamicRegistry.Key<T>> RegistryKey(@NotNull @NotNull Function<Registries, DynamicRegistry<T>> selector) -
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) -
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
-