Pages

readObject

    public static Object readObject(String filename) {
try {
InputStream fis = FileUtils.class
.getResourceAsStream("/com/andalas/ser/" + filename);

if (fis != null) {
ObjectInputStream ois = new ObjectInputStream(fis);
Object object = ois.readObject();

ois.close();

return object;
}
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}

return null;
}

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.