mirror of
https://github.com/corda/corda.git
synced 2025-04-07 19:34:41 +00:00
Make ArrayList's serialization compatible with OpenJDK's
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
7e72f4362b
commit
2a9ab48137
@ -10,6 +10,10 @@
|
||||
|
||||
package java.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
||||
public class ArrayList<T> extends AbstractList<T> implements java.io.Serializable {
|
||||
private static final int MinimumCapacity = 16;
|
||||
|
||||
@ -183,4 +187,23 @@ public class ArrayList<T> extends AbstractList<T> implements java.io.Serializabl
|
||||
public String toString() {
|
||||
return Collections.toString(this);
|
||||
}
|
||||
|
||||
private void writeObject(ObjectOutputStream out) throws IOException {
|
||||
out.defaultWriteObject();
|
||||
out.writeInt(array.length);
|
||||
for (T o : this) {
|
||||
out.writeObject(o);
|
||||
}
|
||||
}
|
||||
|
||||
private void readObject(ObjectInputStream in)
|
||||
throws ClassNotFoundException, IOException
|
||||
{
|
||||
in.defaultReadObject();
|
||||
int capacity = in.readInt();
|
||||
grow(capacity);
|
||||
for (int i = 0; i < size; i++) {
|
||||
array[i] = in.readObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user