OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [Serialization.java] - Rev 781

Go to most recent revision | Compare with Previous | Blame | View Log

import java.io.*;
import java.util.*;
 
public class Serialization
{
  public static void main(String[] args) 
    throws IOException, ClassNotFoundException
  {    
    File f = new File("test.ser");
    ObjectOutputStream objStream = 
      new ObjectOutputStream(new FileOutputStream(f));
    objStream.writeInt(8);
    objStream.writeObject(new Integer(99));
    List l = new LinkedList();
    l.add(new Integer(1));
    l.add(new Short((short) 7));
    l.add(new Float(9.95));
    l.add(new Long(-900000000000001l));
    l.add(new Double(-3.14159));
    l.add(new Character('X'));
    l.add(new Byte((byte) 'z'));
    objStream.writeObject(l);
    objStream.close();
 
    ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f));
    System.out.println (ois.readInt());
    System.out.println (ois.readObject());
    System.out.println (ois.readObject());
    ois.close();
    f.delete();
  }
}
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.