예제 #1
0
        /// <summary>
        /// Reads an entire constant pool at the current position of the provided reader.
        /// </summary>
        /// <param name="reader">The reader to use.</param>
        /// <returns>The constant pool that was read.</returns>
        public static ConstantPool FromReader(IBigEndianReader reader)
        {
            var pool = new ConstantPool
            {
                StartOffset = reader.StartPosition
            };

            ushort count = reader.ReadUInt16();

            for (int i = 0; i < count - 1; i++)
            {
                pool.Constants.Add(ConstantInfo.FromReader(reader));
            }

            return(pool);
        }
예제 #2
0
        /// <summary>
        /// Reads an entire constant pool at the current position of the provided reader.
        /// </summary>
        /// <param name="reader">The reader to use.</param>
        /// <returns>The constant pool that was read.</returns>
        public static ConstantPool FromReader(IBigEndianReader reader)
        {
            var pool = new ConstantPool
            {
                StartOffset = reader.StartPosition
            };

            ushort count = reader.ReadUInt16();

            for (var index = 1; index < count;)
            {
                var constant = ConstantInfo.FromReader(reader);
                pool._constants.Add(index, constant);
                index += constant.Size;
            }

            return(pool);
        }