@@ -134,6 +134,7 @@ def bytes(s, encoding):
134134PROPERTY_DUMMY = unhexlify ('19' ) # '\x19'
135135
136136COMPRESSION_METHOD_COPY = unhexlify ('00' ) # '\x00'
137+ COMPRESSION_METHOD_DELTA = unhexlify ('03' ) # '\x03'
137138COMPRESSION_METHOD_LZMA = unhexlify ('030101' ) # '\x03\x01\x01'
138139COMPRESSION_METHOD_CRYPTO = unhexlify ('06' ) # '\x06'
139140COMPRESSION_METHOD_MISC = unhexlify ('04' ) # '\x04'
@@ -605,6 +606,7 @@ def __init__(self, info, start, src_start, folder, archive, maxsize=None):
605606 self .reset ()
606607 self ._decoders = {
607608 COMPRESSION_METHOD_COPY : '_read_copy' ,
609+ COMPRESSION_METHOD_DELTA : '_read_delta' ,
608610 COMPRESSION_METHOD_LZMA : '_read_lzma' ,
609611 COMPRESSION_METHOD_LZMA2 : '_read_lzma2' ,
610612 COMPRESSION_METHOD_MISC_ZIP : '_read_zip' ,
@@ -653,7 +655,17 @@ def _read_copy(self, coder, input, level, num_coders):
653655 self ._file .seek (self ._src_start )
654656 input = self ._file .read (size )
655657 return input [self ._start :self ._start + size ]
656-
658+
659+ def _read_delta (self , coder , input , level , num_coders ):
660+ size = self ._uncompressed [level ]
661+ if not input :
662+ self ._file .seek (self ._src_start )
663+ input = self ._file .read (size )
664+ assert len (coder ['properties' ]) == 1
665+ delta = ord (coder ['properties' ]) + 1
666+ data = pylzma .delta_decode (input , delta )
667+ return data [self ._start :self ._start + size ]
668+
657669 def _read_from_decompressor (self , coder , decompressor , input , level , num_coders , can_partial_decompress = True , with_cache = False ):
658670 size = self ._uncompressed [level ]
659671 data = ''
0 commit comments