public static <T> T loadObjectFromFile(File file, Class<T> clazz) throws IOException { BufferedInputStream in = null; try { in = new BufferedInputStream(new FileInputStream(file)); T video = clazz.cast(XStreamer.destream(in)); return video; } finally { if (in != null) in.close(); } }