Package org.threeten.bp
Class Ser
- java.lang.Object
-
- org.threeten.bp.Ser
-
- All Implemented Interfaces:
java.io.Externalizable,java.io.Serializable
final class Ser extends java.lang.Object implements java.io.ExternalizableThe 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 exampleLOCAL_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
LocalDateyear is written before month. Composite classes, such asLocalDateTimeare serialised as one object.This class is mutable and should be created once per serialization.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static byteDURATION_TYPE(package private) static byteINSTANT_TYPE(package private) static byteLOCAL_DATE_TIME_TYPE(package private) static byteLOCAL_DATE_TYPE(package private) static byteLOCAL_TIME_TYPE(package private) static byteMONTH_DAY_TYPEprivate java.lang.ObjectobjectThe object being serialized.(package private) static byteOFFSET_DATE_TIME_TYPE(package private) static byteOFFSET_TIME_TYPEprivate static longserialVersionUIDSerialization version.private bytetypeThe type being serialized.(package private) static byteYEAR_MONTH_TYPE(package private) static byteYEAR_TYPE(package private) static byteZONE_OFFSET_TYPE(package private) static byteZONE_REGION_TYPE(package private) static byteZONED_DATE_TIME_TYPE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static java.lang.Objectread(java.io.DataInput in)voidreadExternal(java.io.ObjectInput in)Implements theExternalizableinterface to read the object.private static java.lang.ObjectreadInternal(byte type, java.io.DataInput in)private java.lang.ObjectreadResolve()Returns the object that will replace this one.voidwriteExternal(java.io.ObjectOutput out)Implements theExternalizableinterface to write the object.(package private) static voidwriteInternal(byte type, java.lang.Object object, java.io.DataOutput out)
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
Serialization version.- See Also:
- Constant Field Values
-
DURATION_TYPE
static final byte DURATION_TYPE
- See Also:
- Constant Field Values
-
INSTANT_TYPE
static final byte INSTANT_TYPE
- See Also:
- Constant Field Values
-
LOCAL_DATE_TYPE
static final byte LOCAL_DATE_TYPE
- See Also:
- Constant Field Values
-
LOCAL_DATE_TIME_TYPE
static final byte LOCAL_DATE_TIME_TYPE
- See Also:
- Constant Field Values
-
LOCAL_TIME_TYPE
static final byte LOCAL_TIME_TYPE
- See Also:
- Constant Field Values
-
ZONED_DATE_TIME_TYPE
static final byte ZONED_DATE_TIME_TYPE
- See Also:
- Constant Field Values
-
ZONE_REGION_TYPE
static final byte ZONE_REGION_TYPE
- See Also:
- Constant Field Values
-
ZONE_OFFSET_TYPE
static final byte ZONE_OFFSET_TYPE
- See Also:
- Constant Field Values
-
MONTH_DAY_TYPE
static final byte MONTH_DAY_TYPE
- See Also:
- Constant Field Values
-
OFFSET_TIME_TYPE
static final byte OFFSET_TIME_TYPE
- See Also:
- Constant Field Values
-
YEAR_TYPE
static final byte YEAR_TYPE
- See Also:
- Constant Field Values
-
YEAR_MONTH_TYPE
static final byte YEAR_MONTH_TYPE
- See Also:
- Constant Field Values
-
OFFSET_DATE_TIME_TYPE
static final byte OFFSET_DATE_TIME_TYPE
- See Also:
- Constant Field Values
-
type
private byte type
The type being serialized.
-
object
private java.lang.Object object
The object being serialized.
-
-
Method Detail
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOExceptionImplements theExternalizableinterface to write the object.- Specified by:
writeExternalin interfacejava.io.Externalizable- Parameters:
out- the data stream to write to, not null- Throws:
java.io.IOException
-
writeInternal
static void writeInternal(byte type, java.lang.Object object, java.io.DataOutput out) throws java.io.IOException- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOExceptionImplements theExternalizableinterface to read the object.- Specified by:
readExternalin interfacejava.io.Externalizable- Parameters:
in- the data to read, not null- Throws:
java.io.IOException
-
read
static java.lang.Object read(java.io.DataInput in) throws java.io.IOException- Throws:
java.io.IOException
-
readInternal
private static java.lang.Object readInternal(byte type, java.io.DataInput in) throws java.io.IOException- Throws:
java.io.IOException
-
readResolve
private java.lang.Object readResolve()
Returns the object that will replace this one.- Returns:
- the read object, should never be null
-
-