Java Object Serialize serialize(Object obj, String fileName)

Here you can find the source of serialize(Object obj, String fileName)

Description

serialize the given object and save it to given file

License

Open Source License

Declaration

public static void serialize(Object obj, String fileName)
        throws IOException 

Method Source Code

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

import java.io.*;

public class Main {
    /**/*from  ww w  .  j  ava 2s .co m*/
     * serialize the given object and save it to given file
     */
    public static void serialize(Object obj, String fileName)
            throws IOException {
        FileOutputStream fos = new FileOutputStream(fileName);
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        oos.writeObject(obj);
        oos.close();
    }
}

Related

  1. serialize(Object obj)
  2. serialize(Object obj)
  3. serialize(Object obj)
  4. serialize(Object obj, String file)
  5. serialize(Object obj, String fileName)
  6. serialize(Object obj, String fname, boolean gzipped)
  7. serialize(Object objData, Class typeOfT)
  8. serialize(Object object)
  9. serialize(Object object)