Package alexiil.mc.lib.net
Class NetKeyMapper<T>
java.lang.Object
alexiil.mc.lib.net.NetKeyMapper<T>
- Direct Known Subclasses:
NetKeyMapper.OfEnum
,NetKeyMapper.ToString
public abstract class NetKeyMapper<T>
extends java.lang.Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NetKeyMapper.OfEnum<E extends java.lang.Enum<E>>
static class
NetKeyMapper.ToString<T>
-
Field Summary
Fields Modifier and Type Field Description java.lang.Class<T>
clazz
int
length
The known length in bytes of this key, orLENGTH_DYNAMIC
if this isn't a constant.static int
LENGTH_DYNAMIC
-
Constructor Summary
Constructors Constructor Description NetKeyMapper(java.lang.Class<T> clazz)
NetKeyMapper(java.lang.Class<T> clazz, int length)
-
Method Summary
Modifier and Type Method Description abstract T
read(NetByteBuf buffer, IMsgReadCtx ctx)
Reads the value for the key from the buffer, optionally using the parent keys.abstract void
write(NetByteBuf buffer, IMsgWriteCtx ctx, T value)
-
Field Details
-
LENGTH_DYNAMIC
public static final int LENGTH_DYNAMIC- See Also:
- Constant Field Values
-
clazz
-
length
public final int lengthThe known length in bytes of this key, orLENGTH_DYNAMIC
if this isn't a constant.
-
-
Constructor Details
-
Method Details
-
read
Reads the value for the key from the buffer, optionally using the parent keys.Note that any of the parent keys might be null if they failed to read!
- Returns:
- null if the key couldn't be found in whatever context this requires.
- Throws:
InvalidInputDataException
-
write
-