Error in PacketOutputStream.saveUnsignedInt() and PacketInputStream.loadUnsignedInt()

Issue #15 resolved
Ernesto Perez
created an issue

There is a problem serialising and/or deserialising unsigned integers using Styx's PacketOutputStream and PacketInputStream.

Code for the test:

    public static void main(String[] args) throws Exception {
        OutputStream os = new FileOutputStream("test.txt");
        DataOutputStream dos = new DataOutputStream(os);
        PacketOutputStream pos = new PacketOutputStream(dos);
        pos.saveUnsignedInt(1234L);

        os.close();

        InputStream is = new FileInputStream("test.txt");
        DataInputStream dis = new DataInputStream(is);
        byte[] ba = new byte[200];
        System.out.println(dis.read(ba) + " bytes read from the file");
        PacketInputStream pis = new PacketInputStream(ByteBuffer.wrap(ba));
        System.out.println("Resulting value: " + pis.loadUnsignedInt());
    }

Expected value: 1234

Observed value: -46