// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.*;

public class Ser {
    public static void binser(Object[] oa, String filename) {
        try {
            ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filename));
            oos.writeObject(oa);
            oos.close();
        } catch (IOException e) {
        }
    }
    public static Object[] bindeser(String filename) {
        Object[] oa;
        try {
            ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename));
            oa = (Object[])ois.readObject();
            ois.close();
        } catch (ClassNotFoundException e) {
            oa = null;
        } catch (IOException e) {
            oa = null;
        }
        return oa;
    }
    public static void main(String[] args) {
        String[] a = { "A", "BB", "CCC" };
        binser(a, "C:\\binser.dat");
        System.out.println(bindeser("C:\\binser.dat"));
    }
}
