static void writeRule(ZoneOffsetTransitionRule rule,DataOutput out) throws IOException {
  int month=rule.month;
  byte dom=rule.dom;
  int dow=rule.dow;
  LocalTime time=rule.time;
  boolean timeEndOfDay=rule.timeEndOfDay;
  TimeDefinition timeDefinition=rule.timeDefinition;
  ZoneOffset standardOffset=rule.standardOffset;
  ZoneOffset offsetBefore=rule.offsetBefore;
  ZoneOffset offsetAfter=rule.offsetAfter;
  int timeSecs=(timeEndOfDay ? 86400 : time.toSecondOfDay());
  int stdOffset=standardOffset.getTotalSeconds();
  int beforeDiff=offsetBefore.getTotalSeconds() - stdOffset;
  int afterDiff=offsetAfter.getTotalSeconds() - stdOffset;
  int timeByte=(timeSecs % 3600 == 0 ? (timeEndOfDay ? 24 : time.getHour()) : 31);
  int stdOffsetByte=(stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255);
  int beforeByte=(beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3);
  int afterByte=(afterDiff == 0 || afterDiff == 1800 || afterDiff == 3600 ? afterDiff / 1800 : 3);
  int dowByte=(dow == -1 ? 0 : dow);
  int b=(month << 28) + ((dom + 32) << 22) + (dowByte << 19)+ (timeByte << 14)+ (timeDefinition.ordinal() << 12)+ (stdOffsetByte << 4)+ (beforeByte << 2)+ afterByte;
  out.writeInt(b);
  if (timeByte == 31) {
    out.writeInt(timeSecs);
  }
  if (stdOffsetByte == 255) {
    out.writeInt(stdOffset);
  }
  if (beforeByte == 3) {
    out.writeInt(offsetBefore.getTotalSeconds());
  }
  if (afterByte == 3) {
    out.writeInt(offsetAfter.getTotalSeconds());
  }
}

static void writeRule ( ZoneOffsetTransitionRule rule , DataOutput out ) throws IOException { int month = rule . month ; byte dom = rule . dom ; int dow = rule . dow ; LocalTime time = rule . time ; boolean timeEndOfDay = rule . timeEndOfDay ; TimeDefinition timeDefinition = rule . timeDefinition ; ZoneOffset standardOffset = rule . standardOffset ; ZoneOffset offsetBefore = rule . offsetBefore ; ZoneOffset offsetAfter = rule . offsetAfter ; int timeSecs = ( timeEndOfDay ? 86400 : time . toSecondOfDay ( ) ) ; int stdOffset = standardOffset . getTotalSeconds ( ) ; int beforeDiff = offsetBefore . getTotalSeconds ( ) - stdOffset ; int afterDiff = offsetAfter . getTotalSeconds ( ) - stdOffset ; int timeByte = ( timeSecs % 3600 == 0 ? ( timeEndOfDay ? 24 : time . getHour ( ) ) : 31 ) ; int stdOffsetByte = ( stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255 ) ; int beforeByte = ( beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3 ) ; int afterByte = ( afterDiff == 0 || afterDiff == 1800 || afterDiff == 3600 ? afterDiff / 1800 : 3 ) ; int dowByte = ( dow == - 1 ? 0 : dow ) ; int b = ( month << 28 ) + ( ( dom + 32 ) << 22 ) + ( dowByte << 19 ) + ( timeByte << 14 ) + ( timeDefinition . ordinal ( ) << 12 ) + ( stdOffsetByte << 4 ) + ( beforeByte << 2 ) + afterByte ; out . writeInt ( b ) ; if ( timeByte == 31 ) { out . writeInt ( timeSecs ) ; } if ( stdOffsetByte == 255 ) { out . writeInt ( stdOffset ) ; } if ( beforeByte == 3 ) { out . writeInt ( offsetBefore . getTotalSeconds ( ) ) ; } if ( afterByte == 3 ) { out . writeInt ( offsetAfter . getTotalSeconds ( ) ) ; } }
writes the state of the transition rule to the stream .
