Code example for ObjectInputStream

Methods: closereadObject

0
            ByteArrayOutputStream buffer = new ByteArrayOutputStream(); 
            ObjectOutput out = new ObjectOutputStream(buffer); 
            out.writeObject(v1); 
            out.close(); 
 
            ObjectInput in = new ObjectInputStream( 
                    new ByteArrayInputStream(buffer.toByteArray())); 
            v2 = (VectorDataItem) in.readObject(); 
            in.close(); 
        } 
        catch (Exception e) { 
            e.printStackTrace(); 
        } 
        assertEquals(v1, v2); 
    } 
 
} 
Connect your IDE to all the code out there  Get Codota for Java