Java ObjectOutputStream Write saveObject(Object obj, File file)

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

Description

save Object

License

Apache License

Declaration

public static void saveObject(Object obj, File file) 

Method Source Code


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

import java.io.File;

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

import java.io.ObjectOutputStream;

public class Main {
    public static void saveObject(Object obj, File file) {
        try {//from  w w w.  jav a  2s  .  co  m
            ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(file));
            stream.writeObject(obj);
            stream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. saveIndex(String path, Serializable obj)
  2. saveInSerFile(String filename, T object)
  3. saveObject(File file, Object o, boolean overwrite)
  4. saveObject(File file, Serializable obj)
  5. saveObject(Object o, File f)
  6. saveObject(Object object, File file)
  7. saveObject(Object object, String filename)
  8. saveObject(Object object, String filename)
  9. saveObject(Object saveObject, File path)