public class NegativityMessagesManager extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
CHANNEL_ID |
static Map<Byte,Supplier<NegativityMessage>> |
MESSAGES_BY_ID |
static int |
PROTOCOL_VERSION |
| Constructor and Description |
|---|
NegativityMessagesManager() |
| Modifier and Type | Method and Description |
|---|---|
static @Nullable NegativityMessage |
readMessage(byte[] data)
Tries to read a message from the given raw data.
|
static @Nullable NegativityMessage |
readMessage(DataInputStream input)
Tries to read a message from the given input.
|
static byte[] |
writeMessage(NegativityMessage message)
Writes the give message into a raw
byte[]. |
public static final Map<Byte,Supplier<NegativityMessage>> MESSAGES_BY_ID
public static final String CHANNEL_ID
public static final int PROTOCOL_VERSION
public static @Nullable NegativityMessage readMessage(DataInputStream input) throws IOException
The message will be identified by the first byte of the input.
If unknown, null will be returned.
input - the stream containing the messageIOException - if an error of some kind occurred whilst reading the messagepublic static @Nullable NegativityMessage readMessage(byte[] data) throws IOException
The message will be identified by the first byte of the input.
If unknown, null will be returned.
data - the raw data of the messageIOException - if an error of some kind occurred whilst reading the messagepublic static byte[] writeMessage(NegativityMessage message) throws IOException
byte[].message - the message to writeIOException - if an error of some kind occurred whilst writing the message