Java Object Serialize serializeObject(Object object, File f)

Here you can find the source of serializeObject(Object object, File f)

Description

serialize Object

License

Open Source License

Declaration

public static void serializeObject(Object object, File f) throws IOException 

Method Source Code


//package com.java2s;

import java.io.BufferedOutputStream;

import java.io.File;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.OutputStream;

public class Main {
    public static void serializeObject(Object object, File f) throws IOException {

        //use buffering
        OutputStream file = new FileOutputStream(f);
        OutputStream buffer = new BufferedOutputStream(file);
        ObjectOutput output = new ObjectOutputStream(buffer);

        output.writeObject(object);//from w  ww  .j  ava 2s.  co m

        output.close();

    }
}

Related

  1. serializeObject(Object obj)
  2. serializeObject(Object obj, String destPath)
  3. serializeObject(Object obj, String dir)
  4. serializeObject(Object object)
  5. serializeObject(Object object)
  6. serializeObject(Object serializedObject)