Example #1
0
        /// <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>
        /// 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 ZoneOffsetTransition readExternal(java.io.DataInput in) throws java.io.IOException
        internal static ZoneOffsetTransition ReadExternal(DataInput @in)
        {
            long       epochSecond = Ser.ReadEpochSec(@in);
            ZoneOffset before      = Ser.ReadOffset(@in);
            ZoneOffset after       = Ser.ReadOffset(@in);

            if (before.Equals(after))
            {
                throw new IllegalArgumentException("Offsets must not be equal");
            }
            return(new ZoneOffsetTransition(epochSecond, before, after));
        }