class OnDiskSimplePointerList(SimplePointerList):
Known subclasses: pyzim.pointerlist.OnDiskOrderedPointerList
Constructor: OnDiskSimplePointerList(zim, offset, n)
A variant of SimplePointerList that reads pointers always from the disk.
This should be more RAM efficient, but beware that it is likely quite slow.
| Class Method | from |
Load a pointer list from the provided bytestring |
| Class Method | from |
Load a pointer list from a file. |
| Class Method | from |
Load a pointer list from an entry inside a ZIM archive. |
| Class Method | from |
Load a pointer list from a ZIM file at the specified offset. |
| Class Method | new |
Instantiate a new, empty pointerlist. |
| Method | __init__ |
The default constructor. |
| Method | __len__ |
The length of this pointer list. |
| Method | get |
Return the pointer for the specified index. |
| Instance Variable | mutable |
Undocumented |
| Instance Variable | _item |
the size of each item in this list in bytes |
| Instance Variable | _n |
amount of entries in this pointerlist |
| Instance Variable | _offset |
offset of this pointerlist in the zim file |
| Instance Variable | _zim |
zim this pointer list is part of |
Inherited from SimplePointerList:
| Method | __getitem__ |
Get the pointer at the specified index. |
| Method | append |
Append a pointer to the end of pointerlist. |
| Method | get |
Return the index of pointer in this list. |
| Method | get |
Calculate the size of this object when written to a file. |
| Method | iter |
Iterate over all pointers in this pointer list. |
| Method | mass |
Perform a mass update on all pointers in the specified range, changing their value as specified. |
| Method | remove |
Remove the pointer at the specified index. |
| Method | set |
Set the pointer at the specified index. |
| Method | to |
Dump this pointer list into a bytestring and return it. |
| Constant | POINTER |
format of a single pointer |
| Instance Variable | _lock |
Undocumented |
| Instance Variable | _pointers |
list of pointers in this pointer list |
Inherited from ModifiableMixIn (via SimplePointerList):
| Method | add |
Add another modifiable object as a child of this one. |
| Method | after |
This method should be called after this object has been read and/or flushed to disk. In other words, it should be called at least once whenever this object matches the state of the object on the disk. |
| Method | dirty |
Setter for ModifiableMixIn.dirty |
| Method | ensure |
If this object is non-mutable, raise an Exception. |
| Method | get |
Return the size of this object on disk as it has been read. |
| Method | get |
Return the size of this object when written to a file before any modifications has been made since the last read/flush. |
| Method | mark |
Convenience function to mark this object as dirty. |
| Method | remove |
Remove a submodifiable from this object. |
| Instance Variable | dirty |
True if this object or a sub-modifiable has been modified. |
| Instance Variable | _dirty |
a boolean flag that's nonzero if this object has been modified |
| Instance Variable | _old |
the size of this object on disk before any modifications since the last flush/read |
| Instance Variable | _submodifiables |
a list of child objects, whose dirty state will affect this objects dirty state. |
pyzim.pointerlist.OnDiskOrderedPointerListLoad a pointer list from the provided bytestring
NOTE: it is not possible to validate that the string contains the whole pointer list.
| Parameters | |
s:bytes | bytestring to parse |
| Returns | |
pyzim.pointerlist.SimplePointerList | the pointerlist parsed from the bytes |
pyzim.pointerlist.OnDiskOrderedPointerListLoad a pointer list from a file.
| Parameters | |
| f:file-like | file-like object to read from |
n:int | number of entries in the pointer list. |
seek:int or None | if specified, seek this position of the file before reading |
| Returns | |
pyzim.pointerlist.SimplePointerList | the pointerlist read from the file |
pyzim.pointerlist.OnDiskOrderedPointerListLoad a pointer list from an entry inside a ZIM archive.
NOTE: it is not possible to validate that the string contains the whole pointer list.
| Parameters | |
zim:pyzim.archive.Zim | ZIM file to read from |
fullstr | full url of entry to read pointerlist from |
| Returns | |
pyzim.pointerlist.SimplePointerList | the pointerlist parsed from the bytes |
pyzim.pointerlist.OnDiskOrderedPointerListLoad a pointer list from a ZIM file at the specified offset.
This usually acquires the file lock and calls SimplePointerList.from_file, but subclasses may behave differently.
| Parameters | |
zim:pyzim.archive.Zim | ZIM file to read from |
n:int | number of entries in the pointer list. |
seek:int or None | if specified, seek this position of the file before reading |
| Returns | |
pyzim.pointerlist.SimplePointerList | the pointerlist read from the file |
pyzim.pointerlist.SimplePointerList.newpyzim.pointerlist.OnDiskOrderedPointerListInstantiate a new, empty pointerlist.
| Returns | |
SimplePointerList | a new, empty pointerlist |
pyzim.pointerlist.OnDiskOrderedPointerListThe default constructor.
| Parameters | |
zim:pyzim.archive.Zim | zim this pointer list is part of |
offset:int | offset of this pointerlist in the zim file |
n:int | amount of entries in this pointerlist |
Return the pointer for the specified index.
| Parameters | |
i:int | index of pointer to get |
| Returns | |
int | the poiner with the specified index |
| Raises | |
IndexError | when the index is out of bounds. |