Java ObjectOutputStream Write saveObject(String filePath, Serializable obj)

Here you can find the source of saveObject(String filePath, Serializable obj)

Description

save Object

License

Open Source License

Declaration

public static void saveObject(String filePath, Serializable obj) 

Method Source Code

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

import java.io.FileOutputStream;
import java.io.IOException;

import java.io.ObjectOutputStream;
import java.io.Serializable;

public class Main {
    public static void saveObject(String filePath, Serializable obj) {
        FileOutputStream fos = null;
        ObjectOutputStream out = null;
        try {/*  ww w . ja v  a2  s .com*/
            fos = new FileOutputStream(filePath);
            out = new ObjectOutputStream(fos);
            out.writeObject(obj);
            out.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}

Related

  1. saveObject(Object object, String filename)
  2. saveObject(Object saveObject, File path)
  3. saveObject(Serializable obj, String url)
  4. saveObject(String filename, Object obj)
  5. saveObject(String filename, Object obj)
  6. saveObject(T object, File file, boolean use_compression)
  7. saveObject2File(final Serializable object, final File file)
  8. saveObject2FileImpl(final Serializable object, final File file)
  9. saveObjectInFile(String fileName, Object obj)