Code example for ObjectOutputStream

Methods: close, writeObject

0
    public void writeObject(Object o, String fname) {
        FileOutputStream fos = getFos(fname);
        if (fos == null)
            return; 
        try { 
            ObjectOutputStream dos = new ObjectOutputStream(fos);
            dos.writeObject(o);
            dos.close();
        } catch (IOException e) {
            Log.e(this.getClass().getName(), "Could not write object:" + o
                    + "!"); 
            e.printStackTrace();
        } catch (Throwable th){
        	Log.e(this.getClass().getName(), "Problem writing object", th);
        } 
    } 
 
    public Object readObject(String fname) {
        FileInputStream fin = getFin(fname);
        if (fin == null)
            return null;