Code example for ObjectInputStream

Methods: close, readObject

0
 
        FileInputStream fis = null;
        ObjectInputStream ois = null;
        try { 
            fis = context.openFileInput(fileName);
            ois = new ObjectInputStream(fis);
            return (T) ois.readObject();
        } catch (IOException e) {
            throw new LoadException(e);
        } catch (ClassNotFoundException e) {
            throw new LoadException(e);
        } finally { 
            if (ois != null) {
                try { 
                    ois.close();
                } catch (IOException ignore) {
                } 
            } 
 
            if (fis != null) {
                try {