Code example for ObjectOutputStream

Methods: close, reset, writeByte, writeObject

0
		assertTrue("resolved class 2", resolvedClasses[1] == Integer.class);
		assertTrue("resolved class 3", resolvedClasses[2] == Number.class);
	} 
 
    public void test_reset() throws IOException, ClassNotFoundException { 
        oos.reset();
        oos.writeObject("R");
        oos.reset();
        oos.writeByte(24);
        oos.close();
 
        DataInputStream dis = new DataInputStream(loadStream());
        byte[] input = Streams.readFully(dis);
        byte[] result = new byte[] { (byte) 0xac, (byte) 0xed, (byte) 0,
                (byte) 5, (byte) 0x79, (byte) 0x74, (byte) 0, (byte) 1, 
                (byte) 'R', (byte) 0x79, (byte) 0x77, (byte) 1, (byte) 24 }; 
        assertTrue("incorrect output", Arrays.equals(input, result));
 
        ois = new ObjectInputStreamSubclass(loadStream());
        assertEquals("Wrong result from readObject()", "R", ois.readObject());
        assertEquals("Wrong result from readByte()", 24, ois.readByte());