Class: JavaClass::UTF8Constant
- Defined in:
- lib/javaclass/constant.rb
Overview
文字列のConstant
Constant Summary
Constants inherited from Constant
Constant::CONSTANT_Class, Constant::CONSTANT_Double, Constant::CONSTANT_Fieldref, Constant::CONSTANT_Float, Constant::CONSTANT_Integer, Constant::CONSTANT_InterfaceMethodref, Constant::CONSTANT_Long, Constant::CONSTANT_Methodref, Constant::CONSTANT_NameAndType, Constant::CONSTANT_String, Constant::CONSTANT_Utf8
Instance Attribute Summary collapse
-
#bytes ⇒ Object
Returns the value of attribute bytes.
Attributes inherited from Constant
Instance Method Summary collapse
-
#initialize(java_class, tag = nil, bytes = nil) ⇒ UTF8Constant
constructor
コンストラクタ.
- #to_bytes ⇒ Object
- #to_s ⇒ Object
Methods included from Base
#==, #===, #dump, #eql?, #hash, #to_byte
Constructor Details
#initialize(java_class, tag = nil, bytes = nil) ⇒ UTF8Constant
コンストラクタ
*java_class::constantの所有者であるJavaクラス *tag::constantの種類を示すタグ *bytes::値
249 250 251 252 |
# File 'lib/javaclass/constant.rb', line 249 def initialize( java_class, tag=nil, bytes=nil ) super(java_class, tag) @bytes = bytes end |
Instance Attribute Details
#bytes ⇒ Object
Returns the value of attribute bytes.
265 266 267 |
# File 'lib/javaclass/constant.rb', line 265 def bytes @bytes end |
Instance Method Details
#to_bytes ⇒ Object
253 254 255 256 257 258 259 260 261 |
# File 'lib/javaclass/constant.rb', line 253 def to_bytes() tmp = super body = [] @bytes.each_byte {|i| body += to_byte( i, 1 ) } tmp += to_byte( body.length, 2 ) tmp += body end |
#to_s ⇒ Object
262 263 264 |
# File 'lib/javaclass/constant.rb', line 262 def to_s "\"#{bytes}\"" end |