InputStream in = new BufferedInputStream(new FileInputStream(file));
try {
// TODO: expose XStream the driver from XStream
return xs.unmarshal(DEFAULT_DRIVER.createReader(in), o);
} catch (StreamException e) {
throw new IOException2("Unable to read "+file,e);
} catch(ConversionException e) {
throw new IOException2("Unable to read "+file,e);
} catch(Error e) {// mostly reflection errors
throw new IOException2("Unable to read "+file,e);
} finally {
in.close();
}
}