Lines Matching +full:write +full:- +full:output
6 # implementation of gzip-format files.
12 def write32(output, value): argument
13 output.write(chr(value & 255)) ; value=value // 256
14 output.write(chr(value & 255)) ; value=value // 256
15 output.write(chr(value & 255)) ; value=value // 256
16 output.write(chr(value & 255))
25 def compress (filename, input, output): argument
26 output.write('\037\213\010') # Write the header, ...
27 output.write(chr(FNAME)) # ... flag byte ...
31 write32(output, mtime)
32 output.write('\002') # ... slowest compression alg. ...
33 output.write('\377') # ... OS (=unknown) ...
34 output.write(filename+'\000') # ... original filename ...
37 compobj = zlib.compressobj(9, zlib.DEFLATED, -zlib.MAX_WBITS,
44 output.write(compobj.compress(data))
45 output.write(compobj.flush())
46 write32(output, crcval) # ... the CRC ...
47 write32(output, statval[6]) # and the file size.
49 def decompress (input, output): argument
66 # Read and discard a null-terminated string containing the filename
71 # Read and discard a null-terminated string containing a comment
76 input.read(2) # Read & discard the 16-bit header CRC
78 decompobj = zlib.decompressobj(-zlib.MAX_WBITS)
86 output.write(decompdata)
91 output.write(decompdata)
99 input.seek(-8, 2)
116 outputname = filename[:-3]
122 output = open(outputname, 'wb')
125 compress(filename, input, output)
127 decompress(input, output)
130 output.close()