Java ObjectOutputStream Write saveDate(String path, Object obj)

Here you can find the source of saveDate(String path, Object obj)

Description

save Date

License

LGPL

Declaration

public static synchronized void saveDate(String path, Object obj) 

Method Source Code


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

import java.io.File;

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

import java.io.ObjectOutputStream;

public class Main {
    public static String DEF_DATA_DIR;

    public static synchronized void saveDate(String path, Object obj) {
        File file = new File(DEF_DATA_DIR + File.separator + path);
        try {/*from w w  w  .  j a v  a2s  .c om*/
            ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(file));
            out.writeObject(obj);
            out.flush();
            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

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