Java ObjectOutputStream Write saveObject(Object o, File f)

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

Description

save Object

License

BSD License

Declaration

static void saveObject(Object o, File f) 

Method Source Code

//package com.java2s;
/*//from   w w  w.  j av  a 2  s  .  c o  m
 * Copyright 2011 Holger Brandl
 *
 * This code is licensed under BSD. For details see
 * http://www.opensource.org/licenses/bsd-license.php
 */

import java.io.*;

public class Main {
    static void saveObject(Object o, File f) {
        try {
            FileOutputStream fout = new FileOutputStream(f);
            ObjectOutputStream oos = new ObjectOutputStream(fout);
            oos.writeObject(o);
            oos.close();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

Related

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