Package org.threeten.bp.chrono
Class Ser
java.lang.Object
org.threeten.bp.chrono.Ser
- All Implemented Interfaces:
Externalizable,Serializable
The shared serialization delegate for this package.
Implementation notes
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 exampleJAPANESE_DATE_TYPE_VERSION_2 = 21.
In order to serialise the object it writes its byte and then calls back to the appropriate class where the serialisation is performed. In order to deserialise the object it read in the type byte, switching in order to select which class to call back into.
The serialisation 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 serialised as one object.
This class is mutable and should be created once per serialization.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final byte(package private) static final byte(package private) static final byte(package private) static final byte(package private) static final byte(package private) static final byte(package private) static final byte(package private) static final byte(package private) static final byteprivate ObjectThe object being serialized.private static final longSerialization version.(package private) static final byte(package private) static final byteprivate byteThe type being serialized. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static Objectread(ObjectInput in) voidImplements theExternalizableinterface to read the object.private static ObjectreadInternal(byte type, ObjectInput in) private ObjectReturns the object that will replace this one.voidImplements theExternalizableinterface to write the object.private static voidwriteInternal(byte type, Object object, ObjectOutput out)
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version.- See Also:
-
JAPANESE_DATE_TYPE
static final byte JAPANESE_DATE_TYPE- See Also:
-
JAPANESE_ERA_TYPE
static final byte JAPANESE_ERA_TYPE- See Also:
-
HIJRAH_DATE_TYPE
static final byte HIJRAH_DATE_TYPE- See Also:
-
HIJRAH_ERA_TYPE
static final byte HIJRAH_ERA_TYPE- See Also:
-
MINGUO_DATE_TYPE
static final byte MINGUO_DATE_TYPE- See Also:
-
MINGUO_ERA_TYPE
static final byte MINGUO_ERA_TYPE- See Also:
-
THAIBUDDHIST_DATE_TYPE
static final byte THAIBUDDHIST_DATE_TYPE- See Also:
-
THAIBUDDHIST_ERA_TYPE
static final byte THAIBUDDHIST_ERA_TYPE- See Also:
-
CHRONO_TYPE
static final byte CHRONO_TYPE- See Also:
-
CHRONO_LOCALDATETIME_TYPE
static final byte CHRONO_LOCALDATETIME_TYPE- See Also:
-
CHRONO_ZONEDDATETIME_TYPE
static final byte CHRONO_ZONEDDATETIME_TYPE- See Also:
-
type
private byte typeThe type being serialized. -
object
The object being serialized.
-
-
Constructor Details
-
Ser
public Ser()Constructor for deserialization. -
Ser
Ser(byte type, Object object) Creates an instance for serialization.- Parameters:
type- the typeobject- the object
-
-
Method Details
-
writeExternal
Implements theExternalizableinterface to write the object.- Specified by:
writeExternalin interfaceExternalizable- Parameters:
out- the data stream to write to, not null- Throws:
IOException
-
writeInternal
- Throws:
IOException
-
readExternal
Implements theExternalizableinterface to read the object.- Specified by:
readExternalin interfaceExternalizable- Parameters:
in- the data to read, not null- Throws:
IOExceptionClassNotFoundException
-
read
- Throws:
IOExceptionClassNotFoundException
-
readInternal
private static Object readInternal(byte type, ObjectInput in) throws IOException, ClassNotFoundException - Throws:
IOExceptionClassNotFoundException
-
readResolve
Returns the object that will replace this one.- Returns:
- the read object, should never be null
-