Commit Graph

12 Commits

Author SHA1 Message Date
dgelessus
5c3bc5d7e5 Remove custom stream types and read all resource data upfront again
The custom stream types were almost always slower than just reading the
entire data into memory, and there's no reason not to do that -
resources are small enough that memory usage and disk IO speed aren't a
concern (at least not for any machine that's modern enough to run
Python 3...).

Perhaps the only performance advantage was when reading a small amount
of data from the start of a compressed resource. In that case the
custom stream could incrementally decompress only the part of the data
that's actually needed, which was a bit faster than decompressing the
entire resource and then throwing away most of the data. But this
situation is rare enough that it's not worth handling in the rsrcfork
library. If this is a real performance issue for someone, they can
manually call the incremental decompression functions from
rsrcfork.compress where needed.
2020-11-01 19:28:25 +01:00
dgelessus
9e6dfacff6 Add custom stream type for compressed resources 2020-08-01 14:11:06 +02:00
dgelessus
ba284d1800 Fix a bunch of flake8 violations 2019-12-30 03:00:12 +01:00
dgelessus
d0e1eaf262 Add raw-compress-info subcommand (#6) 2019-12-26 00:34:27 +01:00
dgelessus
6d69d0097d Update rsrcfork.compress.__all__ 2019-10-02 16:29:32 +02:00
dgelessus
8db1b22bdc Make the generic decompression API stream-based
The non-stream-based APIs still exist as before and are not deprecated,
they just act as thin wrappers around the stream-based API.

The main rsrcfork module doesn't use the stream-based APIs yet, because
it reads each resource's data all at once and not incrementally.
2019-10-02 16:28:40 +02:00
dgelessus
868a322b8e Add Resource.compressed_info attribute
This allows accessing a compressed resource's header data, without
having to decompress it or parse the compressed data manually.
2019-09-23 23:50:29 +02:00
dgelessus
a23cd0fcb2 Simplify decompressor lookup
All decompressors now have exactly the same signature (as a result,
each decompressor now has to check itself that the header type is
correct). This allows the decompressors to be stored in a simple
dictionary, which makes the lookup process much simpler.
2019-09-23 23:32:38 +02:00
dgelessus
53e73be980 Pass complete header info to individual decompressors 2019-09-23 23:19:20 +02:00
dgelessus
9dbdf5b827 Move compressed header info constants/classes to .compress.common
This allows the constants/classes to be accessed from the individual
decompressor submodules.
2019-09-23 23:14:06 +02:00
dgelessus
87d4ae43d4 Refactor parsing of compressed resource headers
In preparation for #3, the compressed resource data headers are parsed
and stored as proper objects. For now these objects are only used
internally by the decompression code, but in the future they can be
exposed.
2019-09-23 23:10:55 +02:00
dgelessus
8904f6e093 Refactor the rsrcfork.compress module into separate submodules
Each decompressor now has its own module, since they share almost no
code between each other.
2019-08-22 21:20:35 +02:00