Java Serialize serializeToFile(Serializable s, String path)

Here you can find the source of serializeToFile(Serializable s, String path)

Description

serialize To File

License

Open Source License

Declaration

public static void serializeToFile(Serializable s, String path) throws IOException 

Method Source Code

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

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

import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;

public class Main {
    public static void serializeToFile(Serializable s, String path) throws IOException {
        FileOutputStream fileOut = new FileOutputStream(path);
        serialize(s, fileOut);/*from   w  ww .  j  a v a2s.c  o  m*/
        fileOut.close();
    }

    public static void serialize(Serializable s, OutputStream os) throws IOException {
        ObjectOutputStream out = new ObjectOutputStream(os);
        out.writeObject(s);
        out.close();
    }
}

Related

  1. serializeShort(short value, byte[] outbuf, int offset)
  2. serializeString(File file, String string)
  3. serializeToBase64(Serializable object)
  4. serializeToFile(Object obj, String fileName)
  5. serializeToFile(Object object, File file)
  6. serializeToString(Object o)
  7. serializeToSurefireDirectory(final Class testClass, final Object object)
  8. serializeUnserialize(Object ob)