Package net.minestom.server.network
Class NetworkBuffer
java.lang.Object
net.minestom.server.network.NetworkBuffer
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final NetworkBuffer.Type
<Point> static final NetworkBuffer.Type
<Integer> static final NetworkBuffer.Type
<Boolean> static final NetworkBuffer.Type
<Byte> static final NetworkBuffer.Type
<byte[]> static final NetworkBuffer.Type
<CatMeta.Variant> static final NetworkBuffer.Type
<Component> static final NetworkBuffer.Type
<WorldPos> static final NetworkBuffer.Type
<Direction> static final NetworkBuffer.Type
<Double> static final NetworkBuffer.Type
<Float> static final NetworkBuffer.Type
<FrogMeta.Variant> static final NetworkBuffer.Type
<Integer> static final NetworkBuffer.Type
<ItemStack> static final NetworkBuffer.Type
<Component> static final NetworkBuffer.Type
<Long> static final NetworkBuffer.Type
<long[]> static final NetworkBuffer.Type
<org.jglrxavpok.hephaistos.nbt.NBT> static final NetworkBuffer.Type
<Point> static final NetworkBuffer.Type
<Component> static final NetworkBuffer.Type
<UUID> static final NetworkBuffer.Type
<PaintingMeta.Variant> static final NetworkBuffer.Type
<Particle> static final NetworkBuffer.Type
<Entity.Pose> static final NetworkBuffer.Type
<float[]> static final NetworkBuffer.Type
<byte[]> static final NetworkBuffer.Type
<Short> static final NetworkBuffer.Type
<SnifferMeta.State> static final NetworkBuffer.Type
<String> static final NetworkBuffer.Type
<Integer> static final NetworkBuffer.Type
<UUID> 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
<int[]> -
Constructor Summary
ConstructorDescriptionNetworkBuffer
(int initialCapacity) NetworkBuffer
(@NotNull ByteBuffer buffer) NetworkBuffer
(@NotNull ByteBuffer buffer, boolean resizable) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
void
copyTo
(int srcOffset, byte @NotNull [] dest, int destOffset, int length) byte @NotNull []
extractBytes
(@NotNull Consumer<@NotNull NetworkBuffer> extractor) static byte[]
makeArray
(@NotNull Consumer<@NotNull NetworkBuffer> writing) <T> T
read
(@NotNull NetworkBuffer.Type<T> type) int
byte[]
readBytes
(int length) <T> @NotNull List
<@NotNull T> readCollection
(@NotNull Function<@NotNull NetworkBuffer, @NotNull T> function, int maxSize) <T> @NotNull List
<@NotNull T> readCollection
(@NotNull NetworkBuffer.Type<T> type, int maxSize) <E extends Enum<?>>
EreadEnumSet
(Class<E> enumType) @NotNull BitSet
readFixedBitSet
(int length) int
void
readIndex
(int readIndex) <T> T
readOptional
(@NotNull Function<@NotNull NetworkBuffer, @NotNull T> function) <T> T
readOptional
(@NotNull NetworkBuffer.Type<T> type) int
skipWrite
(int length) <T> void
write
(@NotNull NetworkBuffer.Type<T> type, T value) <T> void
write
(@NotNull NetworkBuffer.Writer writer) <T extends NetworkBuffer.Writer>
voidwriteCollection
(@Nullable Collection<@NotNull T> values) <T> void
writeCollection
(@Nullable Collection<@NotNull T> values, @NotNull BiConsumer<@NotNull NetworkBuffer, @NotNull T> consumer) <T> void
writeCollection
(@NotNull NetworkBuffer.Type<T> type, @Nullable Collection<@NotNull T> values) final <T> void
writeCollection
(@NotNull NetworkBuffer.Type<T> type, T @Nullable ... values) <E extends Enum<?>>
void<E extends Enum<E>>
voidwriteEnumSet
(EnumSet<E> enumSet, Class<E> enumType) void
writeFixedBitSet
(BitSet set, int length) int
void
writeIndex
(int writeIndex) <T> void
writeOptional
(@NotNull NetworkBuffer.Type<T> type, T value) void
writeOptional
(@Nullable NetworkBuffer.Writer writer)
-
Field Details
-
BOOLEAN
-
BYTE
-
SHORT
-
UNSIGNED_SHORT
-
INT
-
LONG
-
FLOAT
-
DOUBLE
-
VAR_INT
-
VAR_LONG
-
RAW_BYTES
-
STRING
-
NBT
-
BLOCK_POSITION
-
COMPONENT
-
JSON_COMPONENT
-
UUID
-
ITEM
-
BYTE_ARRAY
-
LONG_ARRAY
-
VAR_INT_ARRAY
-
VAR_LONG_ARRAY
-
BLOCK_STATE
-
VILLAGER_DATA
-
DEATH_LOCATION
-
VECTOR3
-
VECTOR3D
-
QUATERNION
-
PARTICLE
-
OPT_CHAT
-
OPT_BLOCK_POSITION
-
OPT_UUID
-
DIRECTION
-
POSE
-
CAT_VARIANT
-
FROG_VARIANT
-
PAINTING_VARIANT
-
SNIFFER_STATE
-
-
Constructor Details
-
NetworkBuffer
-
NetworkBuffer
-
NetworkBuffer
public NetworkBuffer(int initialCapacity) -
NetworkBuffer
public NetworkBuffer()
-
-
Method Details
-
write
-
write
-
read
-
writeOptional
-
writeOptional
-
readOptional
-
readOptional
@Nullable public <T> T readOptional(@NotNull @NotNull Function<@NotNull NetworkBuffer, @NotNull T> function) -
writeCollection
public <T> void writeCollection(@NotNull @NotNull NetworkBuffer.Type<T> type, @Nullable @Nullable Collection<@NotNull T> values) -
writeCollection
@SafeVarargs public final <T> void writeCollection(@NotNull @NotNull NetworkBuffer.Type<T> type, @NotNull T @Nullable ... values) -
writeCollection
public <T extends NetworkBuffer.Writer> void writeCollection(@Nullable @Nullable Collection<@NotNull T> values) -
writeCollection
public <T> void writeCollection(@Nullable @Nullable Collection<@NotNull T> values, @NotNull @NotNull BiConsumer<@NotNull NetworkBuffer, @NotNull T> consumer) -
readCollection
@NotNull public <T> @NotNull List<@NotNull T> readCollection(@NotNull @NotNull NetworkBuffer.Type<T> type, int maxSize) -
readCollection
@NotNull public <T> @NotNull List<@NotNull T> readCollection(@NotNull @NotNull Function<@NotNull NetworkBuffer, @NotNull T> function, int maxSize) -
writeEnum
-
readEnum
-
writeEnumSet
-
readEnumSet
-
writeFixedBitSet
-
readFixedBitSet
-
readBytes
public byte[] readBytes(int length) -
copyTo
public void copyTo(int srcOffset, byte @NotNull [] dest, int destOffset, int length) -
extractBytes
-
clear
public void clear() -
writeIndex
public int writeIndex() -
readIndex
public int readIndex() -
writeIndex
public void writeIndex(int writeIndex) -
readIndex
public void readIndex(int readIndex) -
skipWrite
public int skipWrite(int length) -
readableBytes
public int readableBytes() -
makeArray
-