Package trafficjams.model.util

Source Code of trafficjams.model.util.Serializator

package trafficjams.model.util;

import trafficjams.model.registers.TrafficRegister;

import java.io.*;

/**
* Created by IntelliJ IDEA.
* User: Администратор
* Date: 17.11.11
* Time: 19:11
* To change this template use File | Settings | File Templates.
*/
public class Serializator {
    public static void serialize(File f, TrafficRegister trafficRegister) throws IOException {
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(f)) ;
        oos.writeObject(trafficRegister);
        oos.flush();
        oos.close();
    }
    public static TrafficRegister deSerialize(File f) throws IOException, ClassNotFoundException {
        TrafficRegister retVal = null;
        ObjectInputStream oos = new ObjectInputStream(new FileInputStream(f)) ;
        retVal =(TrafficRegister) oos.readObject();
        return retVal;
    }
}
TOP

Related Classes of trafficjams.model.util.Serializator

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.