Example #1
0
    def write(self, stream):

        stream.write(u2(self.access_flags))
        stream.write(u2(self.name_index))
        stream.write(u2(self.descriptor_index))

        stream.write(u2(len(self.attributes)))
        for attrib in self.attributes:
            attrib.write(stream)
Example #2
0
    def write(self, stream):
        stream.write(u2(self.attribute_name_index))
        stream.write(u4(self.size - 6))

        stream.write(u2(len(self.line_number_table)))

        for entry in self.line_number_table:

            log.info('line number pair ' + `entry`)
            stream.write(u2(entry[0]))
            stream.write(u2(entry[1]))
Example #3
0
    def __init__(self, tag, index):

        assert isinstance(index, int) and index >= 0
        
        ConstantTableEntry.__init__(self, tag)
        self.value = index
        self.bytes = u2(index)
Example #4
0
    def write(self, stream):

        if log.getEffectiveLevel() <= DEBUG:
            log.debug('Writing ' + `self` + ' at ' + getPos(stream))
        
        stream.write(u2(self.attribute_name_index))
        stream.write(u4(self.attribute_length))
        stream.write(u2(self.max_stack))
        stream.write(u2(self.max_locals))
        stream.write(u4(len(self.code)))
        stream.write(self.code)
        stream.write(u2(len(self.exception_table)))
        for exception in self.exception_table:
            exception.write(stream)

        stream.write(u2(len(self.attributes)))
        for attribute in self.attributes:
            attribute.write(stream)
Example #5
0
 def write(self, stream):
     stream.write(u2(self.name_index))
     stream.write(u4(SIZE_OF_CONSTANT_ATTRIBUTE))
     stream.write(u2(self.constant_index))
Example #6
0
    def write(self, stream):

        stream.write(u2(self.start_pc))
        stream.write(u2(self.end_pc))
        stream.write(u2(self.handler_pc))
        stream.write(u2(self.catch_type))
Example #7
0
    def write(self, stream):

        stream.write(u2(self.attribute_name_index))
        stream.write(u4(SOURCE_FILE_ATTRIBUTE_LENGTH))
        stream.write(u2(self.sourcefile_index))
Example #8
0
 def write(self, stream):
     stream.write(u2(self.name_index))
     stream.write(u4(len(self.info)))
     stream.write(self.info)
Example #9
0
    def __init__(self, tag, index1, index2):

        ConstantTableEntry.__init__(self, tag)
        self.value = index1
        self.secondValue = index2
        self.bytes = u2(index1) + u2(index2)
Example #10
0
 def write(self, stream):
     stream.write(u1(self.tag))
     l = len(self.bytes)
     stream.write(u2(l))
     stream.write(self.bytes)
Example #11
0
    def write(self, stream):

        assert isinstance(stream, IOBase)
        
        stream.write(u4(MAGIC))
        stream.write(u2(MINOR_VERSION))
        stream.write(u2(MAJOR_VERSION))
        
        stream.write(u2(len(self.constant_pool) + 1))

        for constant in self.constant_pool:

            if log.getEffectiveLevel() <= DEBUG:
                log.debug('writing constant ' + `constant` + ' at ' + getPos(stream))
            constant.write(stream)

        stream.write(u2(self.access_flags))
        stream.write(u2(self.this_class))
        stream.write(u2(self.super_class))

        stream.write(u2(len(self.interfaces)))
        for interface in self.interfaces:
            stream.write(u2(interface))

        stream.write(u2(len(self.fields)))
        for field in self.fields:
            
            if log.getEffectiveLevel() <= DEBUG:
                log.debug('writing field ' + `field`  + ' at ' + getPos(stream))
            field.write(stream)

        stream.write(u2(len(self.methods)))
        for method in self.methods:

            if log.getEffectiveLevel() <= DEBUG:
                log.debug('writing method ' + `method` + ' at ' + getPos(stream))

            method.write(stream)
        
        stream.write(u2(len(self.attributes)))
        for attribute in self.attributes:

            if log.getEffectiveLevel() <= DEBUG:
                log.debug('writing class attribute ' + `attribute` + ' at ' + getPos(stream))

            attribute.write(stream)