Esempio n. 1
0
        protected internal override ByteVector Write(ClassWriter classWriter, byte[] code
                                                     , int codeLength, int maxStack, int maxLocals)
        {
            var byteVector = new ByteVector();

            byteVector.PutShort(classWriter.NewUTF8(algorithm));
            if (modules == null)
            {
                byteVector.PutShort(0);
            }
            else
            {
                var numModules = modules.Count;
                byteVector.PutShort(numModules);
                for (var i = 0; i < numModules; ++i)
                {
                    var module = modules[i];
                    var hash   = hashes[i];
                    byteVector.PutShort(classWriter.NewModule(module)).PutShort(hash.Length).PutByteArray
                        (hash, 0, hash.Length);
                }
            }

            return(byteVector);
        }
Esempio n. 2
0
        /// <summary>
        ///     Puts the JVMS exception_table corresponding to the Handler list that begins with the given
        ///     element.
        /// </summary>
        /// <remarks>
        ///     Puts the JVMS exception_table corresponding to the Handler list that begins with the given
        ///     element. <i>This includes the exception_table_length field.</i>
        /// </remarks>
        /// <param name="firstHandler">
        ///     the beginning of a Handler list. May be
        ///     <literal>null</literal>
        ///     .
        /// </param>
        /// <param name="output">
        ///     where the exception_table_length and exception_table structures must be put.
        /// </param>
        internal static void PutExceptionTable(Handler firstHandler, ByteVector output)
        {
            output.PutShort(GetExceptionTableLength(firstHandler));
            var handler = firstHandler;

            while (handler != null)
            {
                output.PutShort(handler.startPc.bytecodeOffset).PutShort(handler.endPc.bytecodeOffset
                                                                         ).PutShort(handler.handlerPc.bytecodeOffset).PutShort(handler.catchType);
                handler = handler.nextHandler;
            }
        }
Esempio n. 3
0
        protected internal override ByteVector Write(ClassWriter classWriter, byte[] code
                                                     , int codeLength, int maxStack, int maxLocals)
        {
            var byteVector = new ByteVector();

            byteVector.PutShort(platform == null ? 0 : classWriter.NewUTF8(platform));
            return(byteVector);
        }
Esempio n. 4
0
        protected internal override ByteVector Write(ClassWriter classWriter, byte[] code
                                                     , int codeLength, int maxStack, int maxLocals)
        {
            var byteVector = new ByteVector();

            byteVector.PutShort(resolution);
            return(byteVector);
        }