Here you can find the source of writeObject(Object p_object, File p_outFile)
Parameter | Description |
---|---|
p_object | The object to write. (must support serialization) |
p_outFile | The file to write to |
public static boolean writeObject(Object p_object, File p_outFile)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class Main { /**/*w w w . ja v a2 s. c om*/ * Writes an object to a file using object serialization. * @param p_object The object to write. (must support serialization) * @param p_outFile The file to write to * @return The success status */ public static boolean writeObject(Object p_object, File p_outFile) { try { FileOutputStream fStream = new FileOutputStream(p_outFile); ObjectOutputStream oObject = new ObjectOutputStream(fStream); oObject.writeObject(p_object); oObject.close(); fStream.close(); return true; } catch (IOException e) { e.printStackTrace(); return false; } } }