Package org.threeten.bp
Class Ser
java.lang.Object
org.threeten.bp.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 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 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 byteprivate ObjectThe object being serialized.(package private) static final byte(package private) static final byteprivate static final longSerialization version.private byteThe type being serialized.(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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static ObjectvoidImplements theExternalizableinterface to read the object.private static ObjectreadInternal(byte type, DataInput in) private ObjectReturns the object that will replace this one.voidImplements theExternalizableinterface to write the object.(package private) static voidwriteInternal(byte type, Object object, DataOutput out)
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version.- See Also:
-
DURATION_TYPE
static final byte DURATION_TYPE- See Also:
-
INSTANT_TYPE
static final byte INSTANT_TYPE- See Also:
-
LOCAL_DATE_TYPE
static final byte LOCAL_DATE_TYPE- See Also:
-
LOCAL_DATE_TIME_TYPE
static final byte LOCAL_DATE_TIME_TYPE- See Also:
-
LOCAL_TIME_TYPE
static final byte LOCAL_TIME_TYPE- See Also:
-
ZONED_DATE_TIME_TYPE
static final byte ZONED_DATE_TIME_TYPE- See Also:
-
ZONE_REGION_TYPE
static final byte ZONE_REGION_TYPE- See Also:
-
ZONE_OFFSET_TYPE
static final byte ZONE_OFFSET_TYPE- See Also:
-
MONTH_DAY_TYPE
static final byte MONTH_DAY_TYPE- See Also:
-
OFFSET_TIME_TYPE
static final byte OFFSET_TIME_TYPE- See Also:
-
YEAR_TYPE
static final byte YEAR_TYPE- See Also:
-
YEAR_MONTH_TYPE
static final byte YEAR_MONTH_TYPE- See Also:
-
OFFSET_DATE_TIME_TYPE
static final byte OFFSET_DATE_TIME_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:
IOException
-
read
- Throws:
IOException
-
readInternal
- Throws:
IOException
-
readResolve
Returns the object that will replace this one.- Returns:
- the read object, should never be null
-