void writeExternal(DataOutput out) throws IOException {
  final int timeSecs=(timeEndOfDay ? 86400 : time.toSecondOfDay());
  final int stdOffset=standardOffset.getTotalSeconds();
  final int beforeDiff=offsetBefore.getTotalSeconds() - stdOffset;
  final int afterDiff=offsetAfter.getTotalSeconds() - stdOffset;
  final int timeByte=(timeSecs % 3600 == 0 ? (timeEndOfDay ? 24 : time.getHour()) : 31);
  final int stdOffsetByte=(stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255);
  final int beforeByte=(beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3);
  final int afterByte=(afterDiff == 0 || afterDiff == 1800 || afterDiff == 3600 ? afterDiff / 1800 : 3);
  final int dowByte=(dow == null ? 0 : dow.getValue());
  int b=(month.getValue() << 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());
  }
}

void writeExternal ( DataOutput out ) throws IOException { final int timeSecs = ( timeEndOfDay ? 86400 : time . toSecondOfDay ( ) ) ; final int stdOffset = standardOffset . getTotalSeconds ( ) ; final int beforeDiff = offsetBefore . getTotalSeconds ( ) - stdOffset ; final int afterDiff = offsetAfter . getTotalSeconds ( ) - stdOffset ; final int timeByte = ( timeSecs % 3600 == 0 ? ( timeEndOfDay ? 24 : time . getHour ( ) ) : 31 ) ; final int stdOffsetByte = ( stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255 ) ; final int beforeByte = ( beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3 ) ; final int afterByte = ( afterDiff == 0 || afterDiff == 1800 || afterDiff == 3600 ? afterDiff / 1800 : 3 ) ; final int dowByte = ( dow == null ? 0 : dow . getValue ( ) ) ; int b = ( month . getValue ( ) << 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 to the stream .
