|
|
|
|
@ -8,6 +8,7 @@ import java.nio.ByteOrder;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
|
|
import static seng302.Networking.Utils.ByteConverter.bytesToLong;
|
|
|
|
|
import static seng302.Networking.Utils.ByteConverter.bytesToShort;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Created by hba56 on 20/04/17.
|
|
|
|
|
@ -45,15 +46,6 @@ public class XMLMessageDecoder {
|
|
|
|
|
this.xmlMessage = new String(xmlMessagebytes);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private short bytesToShort(byte[] bytesShort){
|
|
|
|
|
ByteBuffer byteBuffer = ByteBuffer.allocate(2);
|
|
|
|
|
byteBuffer.order(ByteOrder.LITTLE_ENDIAN);
|
|
|
|
|
byteBuffer.put(bytesShort[0]);
|
|
|
|
|
byteBuffer.put(bytesShort[1]);
|
|
|
|
|
short shortVal = byteBuffer.getShort(0);
|
|
|
|
|
return shortVal;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public byte getMessageVersionNumber() {
|
|
|
|
|
return messageVersionNumber;
|
|
|
|
|
}
|
|
|
|
|
@ -83,7 +75,7 @@ public class XMLMessageDecoder {
|
|
|
|
|
* @return xml string as inputsource
|
|
|
|
|
*/
|
|
|
|
|
public InputSource getXmlMessageInputSource() {
|
|
|
|
|
InputSource is = new InputSource(new StringReader(xmlMessage));
|
|
|
|
|
InputSource is = new InputSource(new StringReader(xmlMessage.trim()));
|
|
|
|
|
return is;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|