Merge branch 'splitIntoTwoModules' of https://eng-git.canterbury.ac.nz/seng302-2017/team-7 into splitIntoTwoModules

This commit is contained in:
Erika Savell
2017-05-01 15:49:26 +12:00
@@ -8,6 +8,7 @@ import java.nio.ByteOrder;
import java.util.Arrays; import java.util.Arrays;
import static seng302.Networking.Utils.ByteConverter.bytesToLong; import static seng302.Networking.Utils.ByteConverter.bytesToLong;
import static seng302.Networking.Utils.ByteConverter.bytesToShort;
/** /**
* Created by hba56 on 20/04/17. * Created by hba56 on 20/04/17.
@@ -45,15 +46,6 @@ public class XMLMessageDecoder {
this.xmlMessage = new String(xmlMessagebytes); 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() { public byte getMessageVersionNumber() {
return messageVersionNumber; return messageVersionNumber;
} }
@@ -83,7 +75,7 @@ public class XMLMessageDecoder {
* @return xml string as inputsource * @return xml string as inputsource
*/ */
public InputSource getXmlMessageInputSource() { public InputSource getXmlMessageInputSource() {
InputSource is = new InputSource(new StringReader(xmlMessage)); InputSource is = new InputSource(new StringReader(xmlMessage.trim()));
return is; return is;
} }