Packets may now be constructed with string input

This commit is contained in:
Marcin Kostrzewski 2020-10-28 17:50:16 +01:00
parent 2a1b317fb1
commit 1ac0d97ce7

View File

@ -35,6 +35,13 @@ public class ProtocolMessage {
System.arraycopy(message, 0, this.raw, 4, message.length); System.arraycopy(message, 0, this.raw, 4, message.length);
} }
public ProtocolMessage(String message) {
this.length = message.length();
this.message = message.toCharArray();
composeRawData(this.length, this.message);
}
public ProtocolMessage(int length, char[] message) { public ProtocolMessage(int length, char[] message) {
this.length = length; this.length = length;
this.message = message; this.message = message;