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;
}
}