Top Description Fields Constructors Methods
java.time.chrono

pack-priv final Class Ser

extends Object
implements Externalizable
Class Inheritance
All Implemented Interfaces
java.io.Externalizable, java.io.Serializable
Imports
java.io.Externalizable, .IOException, .InvalidClassException, .ObjectInput, .ObjectOutput, .Serializable, .StreamCorruptedException, java.time.LocalDate, .LocalDateTime

The shared serialization delegate for this package.

Implementation Note

This class wraps the object being serialized, and takes a byte representing the type of the class to be serialized. This byte can also be used for versioning the serialization format. In this case another byte flag would be used in order to specify an alternative version of the type format. For example CHRONO_TYPE_VERSION_2 = 21

In order to serialize the object it writes its byte and then calls back to the appropriate class where the serialization is performed. In order to deserialize the object it read in the type byte, switching in order to select which class to call back into.

The serialization format is determined on a per class basis. In the case of field based classes each of the fields is written out with an appropriate size format in descending order of the field's size. For example in the case of LocalDate year is written before month. Composite classes, such as LocalDateTime are serialized as one object. Enum classes are serialized using the index of their element.

This class is mutable and should be created once per serialization.

Since
1.8

Field Summary

Modifier and TypeField and Description
pack-priv static final byte
pack-priv static final byte
pack-priv static final byte
pack-priv static final byte
pack-priv static final byte
pack-priv static final byte
pack-priv static final byte
pack-priv static final byte
private Serializable
object

The object being serialized.

private static final long
serialVersionUID

Serialization version.

pack-priv static final byte
private byte
type

The type being serialized.

Constructor Summary

AccessConstructor and Description
public
Ser()

Constructor for deserialization.

pack-priv
Ser(byte
the type
type
,
Serializable
the object
object
)

Creates an instance for serialization.

Method Summary

Modifier and TypeMethod and Description
pack-priv static Serializable
public void
readExternal(ObjectInput
the data stream to read from, not null
in
)

Implements java.io.Externalizable.readExternal.

Implements the Externalizable interface to read the object.

private static Serializable
readInternal(byte type, ObjectInput in)

private Object

Returns:

the read object, should never be null
readResolve
()

Returns the object that will replace this one.

public void
writeExternal(ObjectOutput
the data stream to write to, not null
out
)

Implements java.io.Externalizable.writeExternal.

Implements the Externalizable interface to write the object.

private static void
writeInternal(byte type, Object object, ObjectOutput out)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHRONO_LOCAL_DATE_TIME_TYPEback to summary
pack-priv static final byte CHRONO_LOCAL_DATE_TIME_TYPE
CHRONO_PERIOD_TYPEback to summary
pack-priv static final byte CHRONO_PERIOD_TYPE
CHRONO_TYPEback to summary
pack-priv static final byte CHRONO_TYPE
CHRONO_ZONE_DATE_TIME_TYPEback to summary
pack-priv static final byte CHRONO_ZONE_DATE_TIME_TYPE
HIJRAH_DATE_TYPEback to summary
pack-priv static final byte HIJRAH_DATE_TYPE
JAPANESE_DATE_TYPEback to summary
pack-priv static final byte JAPANESE_DATE_TYPE
JAPANESE_ERA_TYPEback to summary
pack-priv static final byte JAPANESE_ERA_TYPE
MINGUO_DATE_TYPEback to summary
pack-priv static final byte MINGUO_DATE_TYPE
objectback to summary
private Serializable object

The object being serialized.

serialVersionUIDback to summary
private static final long serialVersionUID

Serialization version.

Annotations
@Serial
THAIBUDDHIST_DATE_TYPEback to summary
pack-priv static final byte THAIBUDDHIST_DATE_TYPE
typeback to summary
private byte type

The type being serialized.

Constructor Detail

Serback to summary
public Ser()

Constructor for deserialization.

Serback to summary
pack-priv Ser(byte type, Serializable object)

Creates an instance for serialization.

Parameters
type:byte

the type

object:Serializable

the object

Method Detail

readback to summary
pack-priv static Serializable read(ObjectInput in) throws IOException, ClassNotFoundException
readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Implements java.io.Externalizable.readExternal.

Implements the Externalizable interface to read the object.

Parameters
in:ObjectInput

the data stream to read from, not null

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Externalizable.readExternal.

if I/O errors occur

ClassNotFoundException:

Doc from java.io.Externalizable.readExternal.

If the class for an object being restored cannot be found.

Serial data
The streamed type and parameters defined by the type's writeReplace method are read and passed to the corresponding static factory for the type to create a new instance. That instance is returned as the de-serialized Ser object.
readInternalback to summary
private static Serializable readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException
readResolveback to summary
private Object readResolve()

Returns the object that will replace this one.

Returns:Object

the read object, should never be null

Annotations
@Serial
writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Implements java.io.Externalizable.writeExternal.

Implements the Externalizable interface to write the object.

Parameters
out:ObjectOutput

the data stream to write to, not null

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Externalizable.writeExternal.

Includes any I/O exceptions that may occur

Serial data
Each serializable class is mapped to a type that is the first byte in the stream. Refer to each class writeReplace serialized form for the value of the type and sequence of values for the type.
writeInternalback to summary
private static void writeInternal(byte type, Object object, ObjectOutput out) throws IOException