Code example for ObjectInputStream

Methods: closereadObject

0
            ByteArrayOutputStream buffer = new ByteArrayOutputStream(); 
            ObjectOutput out = new ObjectOutputStream(buffer); 
            out.writeObject(d1); 
            out.close(); 
 
            ObjectInput in = new ObjectInputStream( 
                new ByteArrayInputStream(buffer.toByteArray()) 
            ); 
            d2 = (IntervalXYDelegate) in.readObject(); 
            in.close(); 
        } 
        catch (Exception e) { 
            System.out.println(e.toString()); 
        } 
        assertEquals(d1, d2); 
 
    } 
 
} 
Contextual code suggestions in your IDE  Get Codota for Java