/// <summary> /// Reads the state from the stream. /// </summary> /// <param name="in"> the input stream, not null </param> /// <returns> the created object, not null </returns> /// <exception cref="IOException"> if an error occurs </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: static ZoneRules readExternal(java.io.DataInput in) throws java.io.IOException, ClassNotFoundException internal static ZoneRules ReadExternal(DataInput @in) { int stdSize = @in.ReadInt(); long[] stdTrans = (stdSize == 0) ? EMPTY_LONG_ARRAY : new long[stdSize]; for (int i = 0; i < stdSize; i++) { stdTrans[i] = Ser.ReadEpochSec(@in); } ZoneOffset[] stdOffsets = new ZoneOffset[stdSize + 1]; for (int i = 0; i < stdOffsets.Length; i++) { stdOffsets[i] = Ser.ReadOffset(@in); } int savSize = @in.ReadInt(); long[] savTrans = (savSize == 0) ? EMPTY_LONG_ARRAY : new long[savSize]; for (int i = 0; i < savSize; i++) { savTrans[i] = Ser.ReadEpochSec(@in); } ZoneOffset[] savOffsets = new ZoneOffset[savSize + 1]; for (int i = 0; i < savOffsets.Length; i++) { savOffsets[i] = Ser.ReadOffset(@in); } int ruleSize = @in.ReadByte(); ZoneOffsetTransitionRule[] rules = (ruleSize == 0) ? EMPTY_LASTRULES : new ZoneOffsetTransitionRule[ruleSize]; for (int i = 0; i < ruleSize; i++) { rules[i] = ZoneOffsetTransitionRule.ReadExternal(@in); } return(new ZoneRules(stdTrans, stdOffsets, savTrans, savOffsets, rules)); }
//----------------------------------------------------------------------- /// <summary> /// Checks if this object equals another. /// <para> /// The entire state of the object is compared. /// /// </para> /// </summary> /// <param name="otherRule"> the other object to compare to, null returns false </param> /// <returns> true if equal </returns> public override bool Equals(Object otherRule) { if (otherRule == this) { return(true); } if (otherRule is ZoneOffsetTransitionRule) { ZoneOffsetTransitionRule other = (ZoneOffsetTransitionRule)otherRule; return(Month_Renamed == other.Month_Renamed && Dom == other.Dom && Dow == other.Dow && TimeDefinition_Renamed == other.TimeDefinition_Renamed && Time.Equals(other.Time) && TimeEndOfDay == other.TimeEndOfDay && StandardOffset_Renamed.Equals(other.StandardOffset_Renamed) && OffsetBefore_Renamed.Equals(other.OffsetBefore_Renamed) && OffsetAfter_Renamed.Equals(other.OffsetAfter_Renamed)); } return(false); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private static Object readInternal(byte type, java.io.DataInput in) throws java.io.IOException, ClassNotFoundException private static Object ReadInternal(sbyte type, DataInput @in) { switch (type) { case ZRULES: return(ZoneRules.ReadExternal(@in)); case ZOT: return(ZoneOffsetTransition.ReadExternal(@in)); case ZOTRULE: return(ZoneOffsetTransitionRule.ReadExternal(@in)); default: throw new StreamCorruptedException("Unknown serialized type"); } }
/// <summary> /// Reads the state from the stream. /// </summary> /// <param name="in"> the input stream, not null </param> /// <returns> the created object, not null </returns> /// <exception cref="IOException"> if an error occurs </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: static ZoneOffsetTransitionRule readExternal(java.io.DataInput in) throws java.io.IOException internal static ZoneOffsetTransitionRule ReadExternal(DataInput @in) { int data = @in.ReadInt(); Month month = Month.of((int)((uint)data >> 28)); int dom = ((int)((uint)(data & (63 << 22)) >> 22)) - 32; int dowByte = (int)((uint)(data & (7 << 19)) >> 19); DayOfWeek dow = dowByte == 0 ? null : DayOfWeek.of(dowByte); int timeByte = (int)((uint)(data & (31 << 14)) >> 14); TimeDefinition defn = TimeDefinition.values()[(int)((uint)(data & (3 << 12)) >> 12)]; int stdByte = (int)((uint)(data & (255 << 4)) >> 4); int beforeByte = (int)((uint)(data & (3 << 2)) >> 2); int afterByte = (data & 3); LocalTime time = (timeByte == 31 ? LocalTime.OfSecondOfDay(@in.ReadInt()) : LocalTime.Of(timeByte % 24, 0)); ZoneOffset std = (stdByte == 255 ? ZoneOffset.OfTotalSeconds(@in.ReadInt()) : ZoneOffset.OfTotalSeconds((stdByte - 128) * 900)); ZoneOffset before = (beforeByte == 3 ? ZoneOffset.OfTotalSeconds(@in.ReadInt()) : ZoneOffset.OfTotalSeconds(std.TotalSeconds + beforeByte * 1800)); ZoneOffset after = (afterByte == 3 ? ZoneOffset.OfTotalSeconds(@in.ReadInt()) : ZoneOffset.OfTotalSeconds(std.TotalSeconds + afterByte * 1800)); return(ZoneOffsetTransitionRule.Of(month, dom, dow, time, timeByte == 24, defn, std, before, after)); }