Code example for ObjectInputStream

Methods: closereadObject

0
            ByteArrayOutputStream buffer = new ByteArrayOutputStream(); 
            ObjectOutput out = new ObjectOutputStream(buffer); 
            out.writeObject(e1); 
            out.close(); 
 
            ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( 
                    buffer.toByteArray())); 
            e2 = (CategoryLabelEntity) in.readObject(); 
            in.close(); 
        } 
        catch (Exception e) { 
            e.printStackTrace(); 
        } 
        assertEquals(e1, e2); 
    } 
 
}