Ejemplo n.º 1
0
 public void write(Kryo kryo, Output output, Calendar object) {
   timeZoneSerializer.write(kryo, output, object.getTimeZone()); // can't be null
   output.writeLong(object.getTimeInMillis(), true);
   output.writeBoolean(object.isLenient());
   output.writeInt(object.getFirstDayOfWeek(), true);
   output.writeInt(object.getMinimalDaysInFirstWeek(), true);
   if (object instanceof GregorianCalendar)
     output.writeLong(((GregorianCalendar) object).getGregorianChange().getTime(), false);
   else output.writeLong(DEFAULT_GREGORIAN_CUTOVER, false);
 }
Ejemplo n.º 2
0
 public Calendar read(Kryo kryo, Input input, Class<Calendar> type) {
   Calendar result = Calendar.getInstance(timeZoneSerializer.read(kryo, input, TimeZone.class));
   result.setTimeInMillis(input.readLong(true));
   result.setLenient(input.readBoolean());
   result.setFirstDayOfWeek(input.readInt(true));
   result.setMinimalDaysInFirstWeek(input.readInt(true));
   long gregorianChange = input.readLong(false);
   if (gregorianChange != DEFAULT_GREGORIAN_CUTOVER)
     if (result instanceof GregorianCalendar)
       ((GregorianCalendar) result).setGregorianChange(new Date(gregorianChange));
   return result;
 }