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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [testsuite/] [libjava.lang/] [Serialization.java] - Blame information for rev 767

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

Line No. Rev Author Line
1 765 jeremybenn
import java.io.*;
2
import java.util.*;
3
 
4
public class Serialization
5
{
6
  public static void main(String[] args)
7
    throws IOException, ClassNotFoundException
8
  {
9
    File f = new File("test.ser");
10
    ObjectOutputStream objStream =
11
      new ObjectOutputStream(new FileOutputStream(f));
12
    objStream.writeInt(8);
13
    objStream.writeObject(new Integer(99));
14
    List l = new LinkedList();
15
    l.add(new Integer(1));
16
    l.add(new Short((short) 7));
17
    l.add(new Float(9.95));
18
    l.add(new Long(-900000000000001l));
19
    l.add(new Double(-3.14159));
20
    l.add(new Character('X'));
21
    l.add(new Byte((byte) 'z'));
22
    objStream.writeObject(l);
23
    objStream.close();
24
 
25
    ObjectInputStream ois = new ObjectInputStream(new FileInputStream(f));
26
    System.out.println (ois.readInt());
27
    System.out.println (ois.readObject());
28
    System.out.println (ois.readObject());
29
    ois.close();
30
    f.delete();
31
  }
32
}

powered by: WebSVN 2.1.0

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