test/jdk/java/io/Serializable/optionalDataEnd/OptionalDataEnd.java
changeset 58565 baa5969ecf34
parent 47216 71c04702a3d5
equal deleted inserted replaced
58564:218a1a642c6f 58565:baa5969ecf34
     1 /*
     1 /*
     2  * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    29  */
    29  */
    30 
    30 
    31 import java.io.*;
    31 import java.io.*;
    32 
    32 
    33 class Foo implements Serializable {
    33 class Foo implements Serializable {
       
    34     private static final long serialVersionUID = 1L;
       
    35 
    34     int reps;
    36     int reps;
    35 
    37 
    36     Foo(int reps) {
    38     Foo(int reps) {
    37         this.reps = reps;
    39         this.reps = reps;
    38     }
    40     }
    39 
    41 
    40     private void writeObject(ObjectOutputStream out) throws IOException {
    42     private void writeObject(ObjectOutputStream out) throws IOException {
    41         out.defaultWriteObject();
    43         out.defaultWriteObject();
    42         for (int i = 0; i < reps; i++) {
    44         for (int i = 0; i < reps; i++) {
    43             out.writeObject(new Integer(i));
    45             out.writeObject(i);
    44         }
    46         }
    45     }
    47     }
    46 
    48 
    47     private void readObject(ObjectInputStream in)
    49     private void readObject(ObjectInputStream in)
    48         throws IOException, ClassNotFoundException
    50         throws IOException, ClassNotFoundException