Class MetadataFile
java.lang.Object
net.codecrete.windowsapi.winmd.MetadataFile
Metadata file.
Metadata files are .winmd files in the Portable Executable (PE) format containing metadata in one of the sections.
This class reads .winmd files and provides access to the different components such as tables, blob and strings.
-
Constructor Summary
ConstructorsConstructorDescriptionMetadataFile(InputStream inputStream) Creates a new instance reading the .winmd contents from the provided input stream. -
Method Summary
Modifier and TypeMethodDescriptiongetBlob(int index) Gets the Blob with the specified index from the 'blob' heap.getClassLayout(int parent) Gets the "ClassLayout" row for the specified parent.getConstant(int parent) Gets the "Constant" row for the specified parent.getCustomAttributes(int parent) Gets the "CustomAttribute" rows for the specified parentgetFieldLayout(int field) Gets the "FieldLayout" row for the specified field.getFields(int typeDefIndex) Gets the "Field" rows for the specified type definition.getImplMap(int memberForwarded) Gets the "ImplMap" row for the specified member.getInterfaceImpl(int classIndex) Gets the "InterfaceImpl" rows for the specified class.getMemberRef(int index) Gets the "MemberRef" row for the specified index.getMethodDef(int index) Gets the "MethodDef" row with the specified index.getMethodDefs(int typeDefIndex) Gets the "MethodDef" rows for the specified type definition.intgetModuleRefName(int moduleRef) Gets the ModuleRef name for the specified index.getNestedClass(int nestedClass) Gets the "NestedClass" row for the specified class.getParameters(int methodDefIndex) Gets the "Param" rows for the specified method definition.getString(int index) Gets the string with the specified index from the 'string' heap.getTypeDef(int typeDefIndex) Gets the "TypeDef" row for the specified index.intGets the number of rows in the TypeDef table.Gets an iterator over the TypeDef table.getTypeRef(int index) Gets the "TypeRef" row for the specified index.Gets the version string of the .winmd file.
-
Constructor Details
-
MetadataFile
Creates a new instance reading the .winmd contents from the provided input stream.- Parameters:
inputStream- input stream providing the .winmd contents
-
-
Method Details
-
getVersion
-
getClassLayout
Gets the "ClassLayout" row for the specified parent.- Parameters:
parent- parent (TypeDef index)- Returns:
- class layout
-
getConstant
Gets the "Constant" row for the specified parent.- Parameters:
parent- parent (HasConstant coded index)- Returns:
- constant
-
getCustomAttributes
Gets the "CustomAttribute" rows for the specified parent- Parameters:
parent- (HasCustomAttribute coded index)- Returns:
- iterable for iterating the "CustomAttribute" rows
-
getFields
-
getFieldLayout
Gets the "FieldLayout" row for the specified field.- Parameters:
field- field (Field index)- Returns:
- field layout
-
getImplMap
Gets the "ImplMap" row for the specified member.- Parameters:
memberForwarded- field or method definition (MemberForwarded coded index)- Returns:
- implementation map, or
nullif none is found
-
getInterfaceImpl
Gets the "InterfaceImpl" rows for the specified class.- Parameters:
classIndex- type definition (index into TypeDef table)- Returns:
- iterable for iterating the "InterfaceImpl" rows
-
getMemberRef
Gets the "MemberRef" row for the specified index.- Parameters:
index- row index- Returns:
- member reference
-
getMethodDef
Gets the "MethodDef" row with the specified index.- Parameters:
index- (MethodDef index)- Returns:
- method definition entry
-
getMethodDefs
-
getModuleRefName
public int getModuleRefName(int moduleRef) Gets the ModuleRef name for the specified index.- Parameters:
moduleRef- (ModuleRef index)- Returns:
- string index
-
getNestedClass
Gets the "NestedClass" row for the specified class.- Parameters:
nestedClass- nested class (TypeAlias index)- Returns:
- nested class entry (consisting of nested and enclosing class), or
nullif none is found
-
getParameters
-
getTypeDef
Gets the "TypeDef" row for the specified index.- Parameters:
typeDefIndex- typeDef (index into TypeDef table)- Returns:
- the type definition
-
getTypeDefs
-
getTypeDefinitionCount
public int getTypeDefinitionCount()Gets the number of rows in the TypeDef table.- Returns:
- the number of rows
-
getTypeRef
Gets the "TypeRef" row for the specified index.- Parameters:
index- row index- Returns:
- type reference
-
getString
Gets the string with the specified index from the 'string' heap.- Parameters:
index- string index- Returns:
- string
-
getBlob
Gets the Blob with the specified index from the 'blob' heap.- Parameters:
index- blob index- Returns:
- blob handle
-