Java Object Serialize serialize(Object obj, String fileName)

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

Description

serialize

License

Apache License

Declaration

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

Method Source Code

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

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

import java.io.ObjectOutputStream;

public class Main {
    public static final String FILE_DIR = "src/com/warouss/io/serialization/";

    public static void serialize(Object obj, String fileName) throws IOException {
        FileOutputStream fos = new FileOutputStream(FILE_DIR + fileName);
        ObjectOutputStream oos = new ObjectOutputStream(fos);
        oos.writeObject(obj);// w ww .  j ava2s . c o  m
        fos.close();
    }
}

Related

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