Message ByteBuffer buffer byte transactionVersion throws NxtException

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Message(ByteBuffer buffer, byte transactionVersion) throws NxtException.NotValidException {
super(buffer, transactionVersion);
int messageLength = buffer.getInt();
this.isText = messageLength < 0; // ugly hack
if (messageLength < 0) {
messageLength &= Integer.MAX_VALUE;
}
if (messageLength > Constants.MAX_ARBITRARY_MESSAGE_LENGTH) {
throw new NxtException.NotValidException("Invalid arbitrary message length: " + messageLength);
}
this.message = new byte[messageLength];
buffer.get(this.message);
}