Contents
Class MemorySegmentUtil
java.lang.Object
com.hypixel.hytale.server.core.util.io.MemorySegmentUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ValueLayout.OfFloatstatic final ValueLayout.OfFloatstatic final ValueLayout.OfIntstatic final ValueLayout.OfIntstatic final ValueLayout.OfLongstatic final ValueLayout.OfLongstatic final intstatic final ValueLayout.OfShortstatic final ValueLayout.OfShort -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intreadNumber(MemorySegment data, int offset, int bytes) static StringreadUTF(MemorySegment segment, long offset) Reads a UTF-8 string with a big-endian unsigned short length header.static intutf8Size(MemorySegment segment, long offset) Returns the number of bytes a serialized UTF-8 string occupies at the given offset, including the 2-byte length header.static intReturns the number of bytes a UTF-8 string will occupy when serialized with a 2-byte length header.static voidwriteNumber(MemorySegment data, int offset, int bytes, int value) static intwriteUTF(MemorySegment segment, long offset, String string) Writes a UTF-8 string with a big-endian unsigned short length header.
-
Field Details
-
SHORT_BE
-
SHORT_LE
-
INT_BE
-
INT_LE
-
LONG_BE
-
LONG_LE
-
FLOAT_BE
-
FLOAT_LE
-
MAX_UNSIGNED_SHORT_VALUE
public static final int MAX_UNSIGNED_SHORT_VALUE- See Also:
-
-
Constructor Details
-
MemorySegmentUtil
public MemorySegmentUtil()
-
-
Method Details
-
utf8Size
Returns the number of bytes a UTF-8 string will occupy when serialized with a 2-byte length header. -
utf8Size
Returns the number of bytes a serialized UTF-8 string occupies at the given offset, including the 2-byte length header. -
writeUTF
Writes a UTF-8 string with a big-endian unsigned short length header.- Returns:
- the number of bytes written (length header + encoded string)
-
readUTF
Reads a UTF-8 string with a big-endian unsigned short length header. -
writeNumber
-
readNumber
-