Beispiel #1
0
        /// <summary>
        /// Reads a method from the stream.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        /// <param name="constantPool">The constant pool used for finding the attribute names.</param>
        /// <returns>The method read from the stream.</returns>
        private static JavaMethod ReadMethod(Stream stream, JavaConstantPool constantPool)
        {
            JavaMethodAccessFlags flags = (JavaMethodAccessFlags)stream.ReadShort();
            ushort nameIndex            = stream.ReadShort();
            ushort descriptorIndex      = stream.ReadShort();
            ushort attributesCount      = stream.ReadShort();

            IJavaAttribute[] attributes = JavaAttribute.ReadFromStream(stream, attributesCount, constantPool);
            return(new JavaMethod(flags, nameIndex, descriptorIndex, attributesCount, attributes));
        }
Beispiel #2
0
        /// <summary>
        /// Reads methods from the stream.
        /// </summary>
        /// <param name="stream">The stream to read the methods from.</param>
        /// <param name="count">The number of methods to read.</param>
        /// <param name="constantPool">The constant pool used for finding the attribute names.</param>
        /// <returns>The methods read from the stream.</returns>
        private static JavaMethod[] ReadMethods(Stream stream, int count, JavaConstantPool constantPool)
        {
            JavaMethod[] result = new JavaMethod[count];

            for (int i = 0; i < count; i++)
            {
                result[i] = ReadMethod(stream, constantPool);
            }

            return(result);
        }