Top Description Fields Constructors Methods
java.util

pack-priv final Class CollSer

Located in compilation unit of java.util.ImmutableCollections.

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

A unified serialization proxy class for the immutable collections.
Since
9

Field Summary

Modifier and TypeField and Description
private transient Object[]
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final int
private static final long
private final int
tag

Indicates the type of collection that is serialized.

Constructor Summary

AccessConstructor and Description
pack-priv
CollSer(int t, Object... a)

Method Summary

Modifier and TypeMethod and Description
private void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
ois
)

Reads objects from the stream and stores them in the transient Object[] array field.

private Object

Returns:

a collection created from this proxy object
readResolve
()

Creates and returns an immutable collection from this proxy class.

private void
writeObject(ObjectOutputStream
the ObjectOutputStream to which data is written
oos
)

Writes objects to the stream from the transient Object[] array field.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayback to summary
private transient Object[] array
Since
9
IMM_LISTback to summary
pack-priv static final int IMM_LIST
IMM_LIST_NULLSback to summary
pack-priv static final int IMM_LIST_NULLS
IMM_MAPback to summary
pack-priv static final int IMM_MAP
IMM_SETback to summary
pack-priv static final int IMM_SET
serialVersionUIDback to summary
private static final long serialVersionUID
Annotations
@Serial
tagback to summary
private final int tag

Indicates the type of collection that is serialized. The low order 8 bits have the value 1 for an immutable List, 2 for an immutable Set, 3 for an immutable Map, and 4 for an immutable List that allows null elements. Any other value causes an InvalidObjectException to be thrown. The high order 24 bits are zero when an instance is serialized, and they are ignored when an instance is deserialized. They can thus be used by future implementations without causing compatibility issues.

The tag value also determines the interpretation of the transient Object[] array field. For List and Set, the array's length is the size of the collection, and the array contains the elements of the collection. Null elements are not allowed. For Set, duplicate elements are not allowed.

For Map, the array's length is twice the number of mappings present in the map. The array length is necessarily even. The array contains a succession of key and value pairs: k1, v1, k2, v2, ..., kN, vN. Nulls are not allowed, and duplicate keys are not allowed.

Since
9

Constructor Detail

CollSerback to summary
pack-priv CollSer(int t, Object... a)

Method Detail

readObjectback to summary
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException

Reads objects from the stream and stores them in the transient Object[] array field.

Parameters
ois:ObjectInputStream

the ObjectInputStream from which data is read

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
ClassNotFoundException:
if a serialized class cannot be loaded
InvalidObjectException:
if the count is negative
Since
9
Serial data
A nonnegative int, indicating the count of objects, followed by that many objects.
readResolveback to summary
private Object readResolve() throws ObjectStreamException

Creates and returns an immutable collection from this proxy class. The instance returned is created as if by calling one of the static factory methods for List, Map, or Set. This proxy class is the serial form for all immutable collection instances, regardless of implementation type. This is necessary to ensure that the existence of any particular implementation type is kept out of the serialized form.

Returns:Object

a collection created from this proxy object

Annotations
@Serial
Exceptions
ObjectStreamException:
if another serialization error has occurred
InvalidObjectException:
if the tag value is illegal or if an exception is thrown during creation of the collection
Since
9
writeObjectback to summary
private void writeObject(ObjectOutputStream oos) throws IOException

Writes objects to the stream from the transient Object[] array field.

Parameters
oos:ObjectOutputStream

the ObjectOutputStream to which data is written

Annotations
@Serial
Exceptions
IOException:
if an I/O error occurs
Since
9
Serial data
A nonnegative int, indicating the count of objects, followed by that many objects.