Module | JavaClass::Dsl::Loader |
In: |
lib/javaclass/dsl/loader.rb
|
Read and disassemble the given class inside data (byte data). Might throw a ClassFile::ClassFormatError if the classfile is not valid. This creates a +ClassFile::JavaClassHeader+ .
# File lib/javaclass/dsl/loader.rb, line 35 def disassemble(data) ClassFile::JavaClassHeader.new(data) end
Read and disassemble the given class classname from classpath .
# File lib/javaclass/dsl/loader.rb, line 23 def load_cp(classname, classpath) begin disassemble(classpath.load_binary(classname)) rescue ClassFile::ClassFormatError => ex ex.add_classname(classname, classpath.to_s) raise ex end end
Read and disassemble the given class from filename (full file name).
# File lib/javaclass/dsl/loader.rb, line 13 def load_fs(filename) begin disassemble(File.open(filename, 'rb') { |io| io.read.freeze } ) rescue ClassFile::ClassFormatError => ex ex.add_classname(filename) raise ex end end