Exemplo n.º 1
0
def decompress(string, wbits=0, bufsize=16384):
    inflater = Inflater(wbits < 0)
    try:
        inflater.setInput(_to_input(string))
        return _get_inflate_data(inflater)
    finally:
        inflater.end()
Exemplo n.º 2
0
def decompress(string, wbits=0, bufsize=16384):
    inflater = Inflater(wbits < 0)
    try:
        inflater.setInput(_to_input(string))
        data = _get_inflate_data(inflater)
        if not inflater.finished():
            raise error, "Error -5 while decompressing data: incomplete or truncated stream"
        return data
    finally:
        inflater.end()
Exemplo n.º 3
0
    def __init__(self, wbits=MAX_WBITS):

        # Jython only uses wbits to determine to skip the header if it's negative;
        # but apparently there are some tests around this that we do some bogus
        # param checking

        if abs(wbits) < 8:
            raise ValueError, "Invalid initialization option"
        if abs(wbits) > 16:  # NOTE apparently this also implies being negative in CPython/zlib
            wbits = -1

        self.inflater = Inflater(wbits < 0)
        self._ended = False
        self.unused_data = ""
        self.unconsumed_tail = ""
        self.gzip = wbits < 0
        self.gzip_header_skipped = False
Exemplo n.º 4
0
 def __init__(self, wbits=MAX_WBITS):
     if abs(wbits) > MAX_WBITS or abs(wbits) < 8:
         raise ValueError, "Invalid initialization option"
     self.inflater = Inflater(wbits < 0)
     self.unused_data = ""
     self._ended = False
Exemplo n.º 5
0
def decompress(string, wbits=0, bufsize=16384):
    inflater = Inflater(wbits < 0)
    inflater.setInput(string)

    return _get_inflate_data(inflater)