The message encoders and decoders now catch exceptions, and throw InvalidMessageException.

Removed the big switch statement from BinaryMessageDecoder - it now uses the decoder factory instead.
issue #35 #36
#story[1095]
This commit is contained in:
fjc40
2017-08-06 22:25:43 +12:00
parent 9c64b678e3
commit 134586f407
34 changed files with 879 additions and 719 deletions
@@ -1,6 +1,7 @@
package network.MessageDecoders;
import network.Exceptions.InvalidMessageException;
import network.Messages.AC35Data;
@@ -15,7 +16,8 @@ public interface MessageDecoder {
* Decodes a given message.
* @param encodedMessage The message to decode.
* @return The decoded message.
* @throws InvalidMessageException Thrown if the encoded message is invalid in some way, or cannot be decoded.
*/
public AC35Data decode(byte[] encodedMessage);
public AC35Data decode(byte[] encodedMessage) throws InvalidMessageException;
}