|
|
@ -0,0 +1,32 @@ |
|
|
|
|
|
|
|
import controller.ObjReader; |
|
|
|
import controller.ObjWriter; |
|
|
|
import model.People; |
|
|
|
import model.Person; |
|
|
|
|
|
|
|
import java.io.File; |
|
|
|
|
|
|
|
public class Main { |
|
|
|
public static void main(String[] args) { |
|
|
|
File file = new File("person.bin"); |
|
|
|
|
|
|
|
//Create list |
|
|
|
People data = new People(); |
|
|
|
//Init list |
|
|
|
data.add(new Person("Manolo", 32)); |
|
|
|
data.add(new Person("Jorge", 2)); |
|
|
|
data.add(new Person("Pepe", 89)); |
|
|
|
|
|
|
|
//Check writing |
|
|
|
boolean isWritten = ObjWriter.write(data,file); |
|
|
|
|
|
|
|
//Test serialization |
|
|
|
People p; |
|
|
|
if (isWritten) { |
|
|
|
p = (People) ObjReader.read(file); |
|
|
|
System.out.println(p.toString()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |