Commit 3ad32322 authored by 张永's avatar 张永

加个方法

parent 5b04f123
......@@ -572,5 +572,26 @@ public class FileUtil {
}
}
public static Object fileToObject(File file) {
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
fis = new FileInputStream(file);
ois = new ObjectInputStream(fis);
return ois.readObject();
} catch (FileNotFoundException e) {
throw new FileUtilException(e);
} catch (IOException e) {
throw new FileUtilException(e);
} catch (ClassNotFoundException e) {
throw new FileUtilException(e);
} finally {
try {
ois.close();
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment