Ejemplo n.º 1
0
def parseProductInfo(parent, size):
    yield Int32(parent, "product_id")
    yield Int32(parent, "edition")
    yield UInt8(parent, "major_version")
    yield UInt8(parent, "minor_version")
    yield Int64(parent, "build_number")
    yield Int64(parent, "compilation_date")
Ejemplo n.º 2
0
 def createFields(self):
     yield Enum(UInt8(self, "tag"), self.root.CONSTANT_TYPES)
     if self["tag"].value not in self.root.CONSTANT_TYPES:
         raise ParserError("Java: unknown constant type (%s)" %
                           self["tag"].value)
     self.constant_type = self.root.CONSTANT_TYPES[self["tag"].value]
     if self.constant_type == "Utf8":
         yield PascalString16(self, "bytes", charset="UTF-8")
     elif self.constant_type == "Integer":
         yield Int32(self, "bytes")
     elif self.constant_type == "Float":
         yield Float32(self, "bytes")
     elif self.constant_type == "Long":
         yield Int64(self, "bytes")
     elif self.constant_type == "Double":
         yield Float64(self, "bytes")
     elif self.constant_type == "Class":
         yield CPIndex(self,
                       "name_index",
                       "Class or interface name",
                       target_types="Utf8")
     elif self.constant_type == "String":
         yield CPIndex(self, "string_index", target_types="Utf8")
     elif self.constant_type == "Fieldref":
         yield CPIndex(self,
                       "class_index",
                       "Field class or interface name",
                       target_types="Class")
         yield CPIndex(self,
                       "name_and_type_index",
                       target_types="NameAndType")
     elif self.constant_type == "Methodref":
         yield CPIndex(self,
                       "class_index",
                       "Method class name",
                       target_types="Class")
         yield CPIndex(self,
                       "name_and_type_index",
                       target_types="NameAndType")
     elif self.constant_type == "InterfaceMethodref":
         yield CPIndex(self,
                       "class_index",
                       "Method interface name",
                       target_types="Class")
         yield CPIndex(self,
                       "name_and_type_index",
                       target_types="NameAndType")
     elif self.constant_type == "NameAndType":
         yield CPIndex(self, "name_index", target_types="Utf8")
         yield CPIndex(self, "descriptor_index", target_types="Utf8")
     else:
         raise ParserError("Not a valid constant pool element type: " +
                           self["tag"].value)
Ejemplo n.º 3
0
 def createFields(self):
     yield Enum(UInt8(self, "typecode"), TYPECODE_NAMES)
     yield PascalString16(self, "className", charset="UTF-8")
     yield Int64(self, "serialVersionUID")
     self.root.newHandle(self)
     yield NullBits(self, "classDescFlags_reserved", 3)
     yield Bit(self, "classDescFlags_enum", "Is the class an Enum?")
     yield Bit(
         self, "classDescFlags_block_data",
         "Was the externalizable's block data written using stream version 2?"
     )
     yield Bit(self, "classDescFlags_externalizable",
               "Does the class implement java.io.Externalizable?")
     yield Bit(self, "classDescFlags_serializable",
               "Does the class implement java.io.Serializable?")
     yield Bit(self, "classDescFlags_write_method",
               "Does the class have a writeObject method?")
     yield Int16(self, "fieldDesc_count")
     for i in xrange(self['fieldDesc_count'].value):
         yield FieldDesc(self, "fieldDesc[]")
     yield ClassAnnotation(self, "classAnnotation")
     yield SerializedContent(self, "superClassDesc")
Ejemplo n.º 4
0
def parseInt64(parent):
    yield Int64(parent, "value")
Ejemplo n.º 5
0
 def createFields(self):
     yield Int64(self, "length")
     yield String(self, "value", charset="UTF-8")