Module jvm :: Class JVMFormat
[hide private]
[frames] | no frames]

Class JVMFormat

source code

        object --+    
                 |    
bytecode._Bytecode --+
                     |
                    JVMFormat

An object which is the main class to handle properly a class file. Exported fields : magic, minor_version, major_version, constant_pool_count, access_flags, this_class, super_class, interfaces_count, fields_count, methods_count, attributes_count

Instance Methods [hide private]
 
__init__(self, buff)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
_load_class(self) source code
 
get_class(self, class_name)
Verify the name of the class
source code
 
get_classes_names(self)
Return the names of classes
source code
 
get_name(self) source code
 
get_classes(self) source code
 
get_field(self, name)
Return into a list all fields which corresponds to the regexp
source code
MethodInfo
get_method_descriptor(self, class_name, method_name, descriptor)
Return the specific method
source code
FieldInfo
get_field_descriptor(self, class_name, field_name, descriptor)
Return the specific field
source code
 
get_method(self, name)
Return into a list all methods which corresponds to the regexp
source code
 
get_all_fields(self) source code
 
get_fields(self)
Return all objects fields
source code
 
get_methods(self)
Return all objects methods
source code
 
get_constant_pool(self)
Return the constant pool list
source code
 
get_strings(self)
Return all strings into the class
source code
 
get_class_manager(self)
Return directly the class manager
source code
 
set_used_field(self, old, new)
Change the description of a field
source code
 
set_used_method(self, old, new)
Change the description of a method
source code
 
show(self)
Show the .class format into a human readable format
source code
 
pretty_show(self, vm_a)
Show the .class format into a human readable format
source code
 
insert_string(self, value)
Insert a string into the constant pool list (Constant_Utf8)
source code
 
insert_field(self, class_name, name, descriptor)
Insert a field into the class
source code
 
insert_craft_method(self, name, proto, codes)
Insert a craft method into the class
source code
 
insert_direct_method(self, name, ref_method)
Insert a direct method (MethodInfo object) into the class
source code
 
_fix_attributes_external(self, ref_method) source code
 
_fix_attributes_internal(self, ref_method) source code
 
_insert_basic_method(self, ref_method) source code
 
_get_raw(self) source code
string
save(self)
Return the class (with the modifications) into raw format
source code
 
get_generator(self) source code
 
get_INTEGER_INSTRUCTIONS(self) source code
 
get_type(self) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

    Inherited from bytecode._Bytecode
 
add_idx(self, idx) source code
 
get_buff(self) source code
 
get_idx(self) source code
 
length_buff(self) source code
 
read(self, size) source code
 
read_b(self, size) source code
 
readat(self, off) source code
 
register(self, type_register, fct) source code
 
set_idx(self, idx) source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, buff)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • buff - the buffer which represents the open file
Overrides: object.__init__

get_class(self, class_name)

source code 

Verify the name of the class

Parameters:
  • class_name - the name of the class

    @rtype : True if the class name is valid, otherwise it's False

get_field(self, name)

source code 

Return into a list all fields which corresponds to the regexp

Parameters:
  • name - the name of the field (a regexp)

get_method_descriptor(self, class_name, method_name, descriptor)

source code 

Return the specific method

Parameters:
  • class_name - the class name of the method
  • method_name - the name of the method
  • descriptor - the descriptor of the method
Returns: MethodInfo

get_field_descriptor(self, class_name, field_name, descriptor)

source code 

Return the specific field

Parameters:
  • class_name - the class name of the field
  • field_name - the name of the field
  • descriptor - the descriptor of the field
Returns: FieldInfo

get_method(self, name)

source code 

Return into a list all methods which corresponds to the regexp

Parameters:
  • name - the name of the method (a regexp)

get_class_manager(self)

source code 

Return directly the class manager

@rtype : ClassManager

set_used_field(self, old, new)

source code 

Change the description of a field

Parameters:
  • old - a list of string which contained the original class name, the original field name and the original descriptor
  • new - a list of string which contained the new class name, the new field name and the new descriptor

set_used_method(self, old, new)

source code 

Change the description of a method

Parameters:
  • old - a list of string which contained the original class name, the original method name and the original descriptor
  • new - a list of string which contained the new class name, the new method name and the new descriptor

insert_string(self, value)

source code 

Insert a string into the constant pool list (Constant_Utf8)

Parameters:
  • value - the new string

insert_field(self, class_name, name, descriptor)

source code 

Insert a field into the class

Parameters:
  • class_name - the class of the field
  • name - the name of the field
  • descriptor - a list with the access_flag and the descriptor ( [ "ACC_PUBLIC", "I" ] )

insert_craft_method(self, name, proto, codes)

source code 

Insert a craft method into the class

Parameters:
  • name - the name of the new method
  • proto - a list which describe the method ( [ ACCESS_FLAGS, RETURN_TYPE, ARGUMENTS ], ie : [ "ACC_PUBLIC", "[B", "[B" ] )
  • codes - a list which represents the code into a human readable format ( [ "aconst_null" ], [ "areturn" ] ] )

insert_direct_method(self, name, ref_method)

source code 

Insert a direct method (MethodInfo object) into the class

Parameters:
  • name - the name of the new method
  • ref_method - the MethodInfo Object

save(self)

source code 

Return the class (with the modifications) into raw format

Returns: string
Overrides: bytecode._Bytecode.save