Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package eu.ase.io.serilization;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.ObjectOutputStream;
- import java.net.URL;
- public class ObjectsSave {
- public static void main(String[] args){
- ObjectsGraph og = null;
- try{
- System.out.println("Saving objects ...");
- ObjectOutputStream sout = new ObjectOutputStream(new FileOutputStream("test4.txt"));
- URL o1 = new URL("http://www.google.com");
- URL o2 = o1;
- URL o3 = o1;
- og = new ObjectsGraph(o1, o2);
- sout.writeObject(og);
- //sout.reset();
- sout.writeObject(o3);
- sout.flush();
- System.out.println("og written: " + og);
- System.out.println("o3: " + o3);
- boolean exp = ( (og.o1 == o3) && (og.o1 == og.o2) );
- System.out.println("Exp b: " + exp);
- sout.close();
- }
- catch(IOException e){
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement