Lines Matching full:read
1 """Functions that read and write gzipped files.
17 READ, WRITE = 1, 2
25 return struct.unpack("<I", input.read(4))[0]
64 depending on whether the file will be read or written. The default
86 # underlying file object - in read mode, this causes data corruption.
107 self.mode = READ
110 # Buffer data read from gzip file. extrastart is offset in
188 magic = self.fileobj.read(2)
191 method = ord( self.fileobj.read(1) )
194 flag = ord( self.fileobj.read(1) )
196 # extraflag = self.fileobj.read(1)
197 # os = self.fileobj.read(1)
198 self.fileobj.read(2)
201 # Read & discard the extra field, if present
202 xlen = ord(self.fileobj.read(1))
203 xlen = xlen + 256*ord(self.fileobj.read(1))
204 self.fileobj.read(xlen)
206 # Read and discard a null-terminated string containing the filename
208 s = self.fileobj.read(1)
212 # Read and discard a null-terminated string containing a comment
214 s = self.fileobj.read(1)
218 self.fileobj.read(2) # Read & discard the 16-bit header CRC
224 raise IOError(errno.EBADF, "write() on read-only GzipFile object")
241 def read(self, size=-1):
243 if self.mode != READ:
245 raise IOError(errno.EBADF, "read() on write-only GzipFile object")
287 # if so, it's time to stop; no more members to read.
300 # Read a chunk of data from the file
301 buf = self.fileobj.read(size)
318 # this member, and read a new gzip header.
323 # Check the CRC and file size, and set the flag so we read
337 # We've read to the end of the file, so we have to rewind in order
356 c = self.fileobj.read(1)
373 elif self.mode == READ:
397 if self.mode != READ:
407 return self.mode == READ
428 elif self.mode == READ:
434 self.read(1024)
435 self.read(count % 1024)
455 c = self.read(readsize)
508 chunk = f.read(1024)