Skip to main content

#java again :) Serializing ftw :P

Java again :) Serializing FTW :P

public class C
  {
    public static class Ci implements Serializable {
        public Object o;
    }
    
    public static void main(String[] a) throws IOException, InterruptedException
    {
        List l = new ArrayList<>();
        ObjectOutputStream o = new ObjectOutputStream(new OutputStream(){
            public void write(int b) {/*DEVNULL*/}
        });//ew 
 FileOutputStream(new File("C:\\cg\\out")));      
        Ci c = new Ci();
        Ci c2=c2 = null;
        int i=0;i = 0;
        for (;;) {
        {i++;if    i++;
            if (i%100000==0i % 100000 == 0) {
                System.out.println("Serializing...");
                ;oo.writeObject(c);
                o = new ObjectOutputStream(new OutputStream(){
                    public void write(int b) {/*DEVNULL*/}
                });
                Thread.sleep(1000);
            }
            
            if (false) 
                break;
            c2=c;
            c=newc2 = c;
            c = new Ci();
            c.o=c2;o = c2;
        }
    }
}

Googling a bit around should tell how this one works :P

The modulo operator is to reduce workload and speed the thing up.

#java again :) Serializing ftw :P

public class C
 {
    public static class Ci implements Serializable{public Object o;}
    public static void main(String[] a) throws IOException, InterruptedException
    {
        List l = new ArrayList<>();
        ObjectOutputStream o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});//ew FileOutputStream(new File("C:\\cg\\out")));
        Ci c = new Ci();
        Ci c2= null;
        int i=0;
        for (;;)
        {i++;if(i%100000==0){System.out.println("Serializing...")
                ;o.writeObject(c);
                o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});
                Thread.sleep(1000);}
            if (false)break;
            c2=c;
            c=new Ci();
            c.o=c2;
        }
    }
}

Googling a bit around should tell how this one works :P

The modulo operator is to reduce workload and speed the thing up.

Java again :) Serializing FTW :P

public class C {
    public static class Ci implements Serializable {
        public Object o;
    }
    
    public static void main(String[] a) throws IOException, InterruptedException {
        List l = new ArrayList<>();
        ObjectOutputStream o = new ObjectOutputStream(new OutputStream(){
            public void write(int b) {/*DEVNULL*/}
        }); 
        
        Ci c = new Ci();
        Ci c2 = null;
        int i = 0;
        for (;;) {
            i++;
            if (i % 100000 == 0) {
                System.out.println("Serializing...");
                o.writeObject(c);
                o = new ObjectOutputStream(new OutputStream(){
                    public void write(int b) {/*DEVNULL*/}
                });
                Thread.sleep(1000);
            }
            
            if (false) 
                break;
            
            c2 = c;
            c = new Ci();
            c.o = c2;
        }
    }
}

Googling a bit around should tell how this one works :P

The modulo operator is to reduce workload and speed the thing up.

formatting and syntax coloring
Source Link
Victor Stafusa
  • 8.8k
  • 5
  • 40
  • 61
public class C
{
    public static class Ci implements Serializable{public Object o;}
    public static void main(String[] a) throws IOException, InterruptedException
    {
        List l = new ArrayList<>();
        ObjectOutputStream o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});//ew FileOutputStream(new File("C:\\cg\\out")));
        Ci c = new Ci();
        Ci c2= null;
        int i=0;
        for (;;)
        {i++;if(i%100000==0){System.out.println("Serializing...")
                ;o.writeObject(c);
                o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});
                Thread.sleep(1000);}
            if (false)break;
            c2=c;
            c=new Ci();
            c.o=c2;
        }
    }
}
public class C
{
    public static class Ci implements Serializable{public Object o;}
    public static void main(String[] a) throws IOException, InterruptedException
    {
        List l = new ArrayList<>();
        ObjectOutputStream o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});//ew FileOutputStream(new File("C:\\cg\\out")));
        Ci c = new Ci();
        Ci c2= null;
        int i=0;
        for (;;)
        {i++;if(i%100000==0){System.out.println("Serializing...")
                ;o.writeObject(c);
                o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});
                Thread.sleep(1000);}
            if (false)break;
            c2=c;
            c=new Ci();
            c.o=c2;
        }
    }
}

Googling a bit around should tell how this one works :P the

The modulo operator is to reduce worloadworkload and speed the thing up.

public class C
{
    public static class Ci implements Serializable{public Object o;}
    public static void main(String[] a) throws IOException, InterruptedException
    {
        List l = new ArrayList<>();
        ObjectOutputStream o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});//ew FileOutputStream(new File("C:\\cg\\out")));
        Ci c = new Ci();
        Ci c2= null;
        int i=0;
        for (;;)
        {i++;if(i%100000==0){System.out.println("Serializing...")
                ;o.writeObject(c);
                o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});
                Thread.sleep(1000);}
            if (false)break;
            c2=c;
            c=new Ci();
            c.o=c2;
        }
    }
}

Googling a bit around should tell how this one works :P the modulo operator is to reduce worload and speed the thing up

public class C
{
    public static class Ci implements Serializable{public Object o;}
    public static void main(String[] a) throws IOException, InterruptedException
    {
        List l = new ArrayList<>();
        ObjectOutputStream o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});//ew FileOutputStream(new File("C:\\cg\\out")));
        Ci c = new Ci();
        Ci c2= null;
        int i=0;
        for (;;)
        {i++;if(i%100000==0){System.out.println("Serializing...")
                ;o.writeObject(c);
                o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});
                Thread.sleep(1000);}
            if (false)break;
            c2=c;
            c=new Ci();
            c.o=c2;
        }
    }
}

Googling a bit around should tell how this one works :P

The modulo operator is to reduce workload and speed the thing up.

Source Link
masterX244
  • 4k
  • 2
  • 20
  • 29

#java again :) Serializing ftw :P

public class C
{
    public static class Ci implements Serializable{public Object o;}
    public static void main(String[] a) throws IOException, InterruptedException
    {
        List l = new ArrayList<>();
        ObjectOutputStream o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});//ew FileOutputStream(new File("C:\\cg\\out")));
        Ci c = new Ci();
        Ci c2= null;
        int i=0;
        for (;;)
        {i++;if(i%100000==0){System.out.println("Serializing...")
                ;o.writeObject(c);
                o = new ObjectOutputStream(new OutputStream(){public void write(int b){/*DEVNULL*/}});
                Thread.sleep(1000);}
            if (false)break;
            c2=c;
            c=new Ci();
            c.o=c2;
        }
    }
}

Googling a bit around should tell how this one works :P the modulo operator is to reduce worload and speed the thing up