Code example for ObjectInputStream

Methods: readObject

0
        SQLBlob blob = createSQLBlob(); 
        ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
        ObjectOutputStream out = new ObjectOutputStream(baos); 
        out.writeObject(blob); 
        ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); 
        ObjectInputStream in = new ObjectInputStream(bais); 
        Object obj = in.readObject(); 
 
        assertTrue(obj instanceof StreamingBlob); 
        StreamingBlob sblob = (StreamingBlob)obj; 
 
        assertEquals(sblob.getFilename(), blob.getFilename()); 
        assertEquals(sblob.getDigest(), blob.getDigest()); 
        assertEquals(sblob.getEncoding(), blob.getEncoding()); 
        assertEquals(sblob.getLength(), blob.getLength()); 
        assertEquals(sblob.getMimeType(), blob.getMimeType()); 
    } 
 
}