Package net.minestom.server.network
Class NetworkBuffer
java.lang.Object
net.minestom.server.network.NetworkBuffer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NetworkBuffer.Type<Point>
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<DeathLocation>
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<Long>
static final NetworkBuffer.Type<long[]>
static final NetworkBuffer.Type<org.jglrxavpok.hephaistos.nbt.NBT>
static final NetworkBuffer.Type<Integer>
static final NetworkBuffer.Type<Point>
static final NetworkBuffer.Type<Component>
static final NetworkBuffer.Type<UUID>
static final NetworkBuffer.Type<Integer>
static final NetworkBuffer.Type<Entity.Pose>
static final NetworkBuffer.Type<byte[]>
static final NetworkBuffer.Type<Point>
static final NetworkBuffer.Type<Short>
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<int[]>
-
Constructor Summary
ConstructorsConstructorDescriptionNetworkBuffer
(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) <T> @NotNull List<@NotNull T>
readCollection
(@NotNull NetworkBuffer.Type<T> type) <L,
R> @NotNull Either<L, R> readEither
(@NotNull Function<NetworkBuffer, L> leftReader, Function<NetworkBuffer, R> rightReader) <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) final <T> void
writeCollection
(@NotNull NetworkBuffer.Type<T> type, @NotNull T @Nullable ... values) <T> void
writeCollection
(@NotNull NetworkBuffer.Type<T> type, @Nullable Collection<@NotNull T> values) <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) <L,
R> void writeEither
(Either<L, R> either, BiConsumer<NetworkBuffer, L> leftWriter, BiConsumer<NetworkBuffer, R> rightWriter) <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
-
UUID
-
ITEM
-
BYTE_ARRAY
-
LONG_ARRAY
-
VAR_INT_ARRAY
-
VAR_LONG_ARRAY
-
OPT_CHAT
-
ROTATION
-
OPT_BLOCK_POSITION
-
DIRECTION
-
OPT_UUID
-
OPT_BLOCK_ID
-
VILLAGER_DATA
-
OPT_VAR_INT
-
POSE
-
DEATH_LOCATION
-
CAT_VARIANT
-
FROG_VARIANT
-
-
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 @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) -
readCollection
@NotNull public <T> @NotNull List<@NotNull T> readCollection(@NotNull @NotNull Function<@NotNull NetworkBuffer, @NotNull T> function) -
writeEither
public <L,R> void writeEither(Either<L, R> either, BiConsumer<NetworkBuffer, L> leftWriter, BiConsumer<NetworkBuffer, R> rightWriter) -
readEither
@NotNull public <L,R> @NotNull Either<L,R> readEither(@NotNull @NotNull Function<NetworkBuffer, L> leftReader, Function<NetworkBuffer, R> rightReader) -
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
-