Pkg.AR — API for parsing AR archives¶
Parsing an AR Archive¶
The following code example demonstrates how to parse an AR archive:
from Pro.Core import *
from Pkg.AR import *
def parseArArchive(fname):
c = createContainerFromFile(fname)
if c.isNull():
return
obj = ARObject()
if not obj.Load(c) or not obj.ParseArchive():
return
entry = None
while entry := obj.NextEntry(entry):
print("Name:", entry.name)
# retrieves the entry data as NTContainer
c = obj.GetEntryData(entry)
Module API¶
Pkg.AR module API.
Classes:
ARHeader()This class represents a header of an entry in an AR archive.
ARObject()This class represents an AR archive object.
- class ARHeader¶
This class represents a header of an entry in an AR archive.
- Variables
offset – The offset of the header in the archive.
size – The size of the header.
data_offset – The offset where the data of the entry starts.
data_size – The size of the data of the entry.
name – The name of the entry.
date – The date associated with the entry.
user_id – The user ID associated with the entry.
group_id – The group ID associated with the entry.
mode – The mode (permissions) of the entry.
- class ARObject¶
Bases:
Pro.Core.CFFObjectThis class represents an AR archive object.
Methods:
GetEntryData(entry)Returns the data associated with an AR archive entry.
NextEntry([entry])Retrieves the next entry in the AR archive.
Parses the AR archive.
- GetEntryData(entry) → Pro.Core.NTContainer¶
- Returns
Returns the data associated with an AR archive entry.
- Return type
See also
NextEntry().
- NextEntry(entry: Optional[Pkg.AR.ARHeader] = None) → Optional[Pkg.AR.ARHeader]¶
Retrieves the next entry in the AR archive.
- Parameters
entry (Optional[ARHeader]) – The previous header entry.
- Returns
Returns a header if successful; otherwise returns
None.- Return type
Optional[ARHeader]
See also
ParseArchive()andGetEntryData().
- ParseArchive() → bool¶
Parses the AR archive.
- Returns
Returns
Trueif successful; otherwise returnsFalse.- Return type
bool
See also
NextEntry()andGetEntryData().