Contents
Class ReadCursor
java.lang.Object
com.hypixel.hytale.protocol.io.ReadCursor
Receives the end position of a decode. toObject reports through this where the encoding of the
value it decoded ends, so a caller reading a sequence of variable-size values can advance to the
next one without measuring the decoded value a second time.
One cursor serves a whole decode, so it also counts how deep that decode has walked. A polymorphic value may hold further values of its own base type, and the decode of such a chain recurses once per link. The count bounds the chain, which bounds the stack the decode needs.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLongest chain of nested polymorphic values one decode may walk.intAbsolute segment position of the first byte after the decoded value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidenterNested(String typeName) Counts entry into a nested value.voidCounts the end of the nested value that the matchingenterNested(String)started.
-
Field Details
-
MAX_NESTING_DEPTH
public static final int MAX_NESTING_DEPTHLongest chain of nested polymorphic values one decode may walk. Well above what the protocol uses, and far below the depth that would exhaust the stack of the thread doing the decode. This is a wire limit, so the C# reader (see NestingDepth.Max) uses the same value.- See Also:
-
position
public int positionAbsolute segment position of the first byte after the decoded value.
-
-
Constructor Details
-
ReadCursor
public ReadCursor()
-
-
Method Details
-
enterNested
Counts entry into a nested value. Rejects a value nested pastMAX_NESTING_DEPTH. Every call that returns must be paired withexitNested(). -
exitNested
public void exitNested()Counts the end of the nested value that the matchingenterNested(String)started.
-