Class: Java::Dissassembler

Inherits:
Object
  • Object
show all
Defined in:
lib/java_dissassembler.rb

Constant Summary collapse

CONSTANT_UTF8 =
1
CONSTANT_INTEGER =
3
CONSTANT_FLOAT =
4
CONSTANT_LONG =
5
CONSTANT_DOUBLE =
6
CONSTANT_CLASS =
7
CONSTANT_STRING =
8
CONSTANT_FIELDREF =
9
CONSTANT_METHODREF =
10
CONSTANT_INTERFACEMETHODREF =
11
CONSTANT_NAMEANDTYPE =
12
CONSTANT_METHODHANDLE =
15
CONSTANT_METHODTYPE =
16
CONSTANT_INVOKEDYNAMIC =
18
MAGIC =
"\xCA\xFE\xBA\xBE".each_byte.to_a.freeze

Class Method Summary collapse

Class Method Details

.dissassemble(bytes) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/java_dissassembler.rb', line 28

def dissassemble(bytes)
  if bytes.is_a?(Array)
    do_dissassemble(bytes)
  elsif bytes.is_a?(String)
    do_dissassemble(bytes.each_byte.to_a)
  else
    raise "Expected `bytes' to be Array of bytes or String of bytes"
  end
end

.dissassemble_file(path) ⇒ Object



38
39
40
41
42
# File 'lib/java_dissassembler.rb', line 38

def dissassemble_file(path)
  File.open(path) do |file|
    dissassemble(file.read)
  end
end