Class JodaLocalDateSerializer


  • public class JodaLocalDateSerializer
    extends com.esotericsoftware.kryo.Serializer<org.joda.time.LocalDate>
    A Kryo serializer for joda LocalDate. The LocalDate object is read or written as year, month-of-year and day-of-month packed into one integer, and chronology as a separate attribute. No time zone is involved. If the chronology is ISOChronology the attribute is serialized as an empty string, thus ISOChronology is considered to be default. Note that internally the LocalDate object makes use of an iLocalMillis value, but that field is not accessible for reading here because the getLocalMillis() method is protected. There could conceivably be cases where a user has created a derived version of LocalDate, and is using the iLocalMillis value in some way that this serialization/deserialization will break. (Alternative implementation: access the field using Java reflection?)

    The following chronologies are supported:

    • ISOChronology
    • CopticChronology
    • EthiopicChronology
    • GregorianChronology
    • JulianChronology
    • IslamicChronology
    • BuddhistChronology
    • GJChronology

    Author:
    Rennie Petersen
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.joda.time.LocalDate read​(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input, Class<? extends org.joda.time.LocalDate> type)  
      void write​(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output, org.joda.time.LocalDate localDate)  
      • Methods inherited from class com.esotericsoftware.kryo.Serializer

        copy, getAcceptsNull, isImmutable, setAcceptsNull, setImmutable
    • Constructor Detail

      • JodaLocalDateSerializer

        public JodaLocalDateSerializer()
    • Method Detail

      • read

        public org.joda.time.LocalDate read​(com.esotericsoftware.kryo.Kryo kryo,
                                            com.esotericsoftware.kryo.io.Input input,
                                            Class<? extends org.joda.time.LocalDate> type)
        Specified by:
        read in class com.esotericsoftware.kryo.Serializer<org.joda.time.LocalDate>
      • write

        public void write​(com.esotericsoftware.kryo.Kryo kryo,
                          com.esotericsoftware.kryo.io.Output output,
                          org.joda.time.LocalDate localDate)
        Specified by:
        write in class com.esotericsoftware.kryo.Serializer<org.joda.time.LocalDate>