Java ObjectOutputStream Write saveObject(Object saveObject, File path)

Here you can find the source of saveObject(Object saveObject, File path)

Description

Saves an Object to a file (can only be used on serializable Objects)

License

LGPL

Parameter

Parameter Description
saveObject Object to save
path Path to save the Object to

Exception

Parameter Description
IOException an exception

Declaration


public static void saveObject(Object saveObject, File path) throws IOException 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.io.*;

public class Main {
    /**/*w  w w.  j a va 2s.c om*/
     * <p>Saves an Object to a file (can only be used on serializable Objects)</p>
     * @param saveObject Object to save
     * @param path Path to save the Object to
     * @throws IOException
     */
    //Saves an Object to a file
    public static void saveObject(Object saveObject, File path) throws IOException {
        ObjectOutputStream o = new ObjectOutputStream(new FileOutputStream(path, false));
        o.writeObject(saveObject);
        o.close();
    }
}

Related

  1. saveObject(Object o, File f)
  2. saveObject(Object obj, File file)
  3. saveObject(Object object, File file)
  4. saveObject(Object object, String filename)
  5. saveObject(Object object, String filename)
  6. saveObject(Serializable obj, String url)
  7. saveObject(String filename, Object obj)
  8. saveObject(String filename, Object obj)
  9. saveObject(String filePath, Serializable obj)