Java ObjectOutputStream Write saveData(Object data, String filename)

Here you can find the source of saveData(Object data, String filename)

Description

save Data

License

Open Source License

Declaration

public static boolean saveData(Object data, String filename) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.FileOutputStream;

import java.io.ObjectOutputStream;

public class Main {
    public static boolean saveData(Object data, String filename) {
        try {//from w  w  w  .ja v a 2  s  . c om
            FileOutputStream fo = new FileOutputStream(filename);
            ObjectOutputStream oo = new ObjectOutputStream(fo);
            oo.writeObject(data);
            oo.close();
            fo.close();
        } catch (Exception e) {
            return false;
        }
        return true;
    }
}

Related

  1. save(String name, Serializable object)
  2. saveAllPlaying(Object obj, String path)
  3. saveBinary(File dumpFile, Object object)
  4. saveCompressed(String filename, Object o)
  5. saveData(HashMap data, String filename)
  6. saveDate(String path, Object obj)
  7. saveFile(Object o, File file)
  8. saveFile(Object o, String filename)
  9. saveGZipObject(Object toSave, File file)