Java Serializable Serialize serializeObject(Serializable obj, String filename)

Here you can find the source of serializeObject(Serializable obj, String filename)

Description

serialize Object

License

Open Source License

Declaration

public static void serializeObject(Serializable obj, String filename) 

Method Source Code

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

import java.io.FileOutputStream;
import java.io.ObjectOutputStream;
import java.io.IOException;
import java.io.Serializable;

public class Main {
    public static void serializeObject(Serializable obj, String filename) {
        try {/* w  ww. j a  va 2 s  .  c  o m*/
            FileOutputStream fos = new FileOutputStream(filename);
            ObjectOutputStream os = new ObjectOutputStream(fos);
            os.writeObject(obj);
            os.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
}

Related

  1. serializeObject(File inFile, Serializable inObject)
  2. serializeObject(Serializable cds)
  3. serializeObject(Serializable o)
  4. serializeObject(Serializable ser)
  5. serializeObject(Serializable serializable)
  6. serializeObjectToFile(File targetFile, Serializable serializable)