Lines Matching refs:data
33 Note that BZ2File provides a *binary* file interface - data read is
34 returned as bytes, and data to be written should be given as bytes.
42 object, which will be used to read or write the compressed data.
146 """Return buffered data without advancing the file position.
148 Always returns at least one byte of data, unless at EOF.
169 buffer's worth of data if size is negative.
214 def write(self, data):
218 always the length of data in bytes. Note that due to buffering,
219 the file on disk may not reflect the data written until close()
223 if isinstance(data, (bytes, bytearray)):
224 length = len(data)
226 # accept any data that supports the buffer protocol
227 data = memoryview(data)
228 length = data.nbytes
230 compressed = self._compressor.compress(data)
313 def compress(data, compresslevel=9):
314 """Compress a block of data.
321 return comp.compress(data) + comp.flush()
324 def decompress(data):
325 """Decompress a block of data.
330 while data:
333 res = decomp.decompress(data)
336 break # Leftover data is not a valid bzip2 stream; ignore it.
341 raise ValueError("Compressed data ended before the "
343 data = decomp.unused_data