Class: JavaClass::CodeAttribute
- Defined in:
- lib/javaclass/attribute.rb
Overview
コード属性
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#codes ⇒ Object
Returns the value of attribute codes.
-
#exception_table ⇒ Object
Returns the value of attribute exception_table.
-
#max_locals ⇒ Object
Returns the value of attribute max_locals.
-
#max_stack ⇒ Object
Returns the value of attribute max_stack.
Attributes inherited from Attribute
Instance Method Summary collapse
-
#initialize(java_class, name_index, max_stack = nil, max_locals = nil, codes = [], exception_table = [], attributes = {}) ⇒ CodeAttribute
constructor
コンストラクタ.
-
#to_bytes ⇒ Object
TODO.
- #to_s ⇒ Object
Methods inherited from Attribute
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class, name_index, max_stack = nil, max_locals = nil, codes = [], exception_table = [], attributes = {}) ⇒ CodeAttribute
コンストラクタ
*java_class::属性の所有者であるJavaクラス *name_index::名前を示すconstant_poolのインデックス *max_stack::オペランドスタックの最大深度 *max_locals::ローカル変数の数 *codes::コード *exception_table::例外 *attributes::属性
789 790 791 792 793 794 795 796 797 |
# File 'lib/javaclass/attribute.rb', line 789 def initialize( java_class, name_index, max_stack=nil, \ max_locals=nil, codes=[], exception_table=[], attributes={} ) super( java_class, name_index) @max_stack = max_stack @max_locals = max_locals @codes = codes @exception_table = exception_table @attributes = attributes end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
826 827 828 |
# File 'lib/javaclass/attribute.rb', line 826 def attributes @attributes end |
#codes ⇒ Object
Returns the value of attribute codes.
824 825 826 |
# File 'lib/javaclass/attribute.rb', line 824 def codes @codes end |
#exception_table ⇒ Object
Returns the value of attribute exception_table.
825 826 827 |
# File 'lib/javaclass/attribute.rb', line 825 def exception_table @exception_table end |
#max_locals ⇒ Object
Returns the value of attribute max_locals.
823 824 825 |
# File 'lib/javaclass/attribute.rb', line 823 def max_locals @max_locals end |
#max_stack ⇒ Object
Returns the value of attribute max_stack.
822 823 824 |
# File 'lib/javaclass/attribute.rb', line 822 def max_stack @max_stack end |
Instance Method Details
#to_bytes ⇒ Object
TODO
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 |
# File 'lib/javaclass/attribute.rb', line 801 def to_bytes bytes = super body = to_byte( @max_stack, 2) body += to_byte( @max_locals, 2) body += to_byte( @codes.length, 4) @codes.each {|c| body += to_byte( c, 1 ) } body += to_byte( @exception_table.length, 2) @exception_table.each {|ex| body += ex.to_bytes() } body += to_byte( @attributes.length, 2) @attributes.each {|k,a| body += a.to_bytes() } bytes += to_byte( body.length, 4) bytes += body end |
#to_s ⇒ Object
798 799 800 |
# File 'lib/javaclass/attribute.rb', line 798 def to_s # TODO end |