Lines Matching refs:buf
129 self.buf = ""
185 self.buf += s
186 while len(self.buf) > self.bufsize:
187 self.fileobj.write(self.buf[:self.bufsize])
188 self.buf = self.buf[self.bufsize:]
198 self.buf += self.cmp.flush()
199 if self.mode == "w" and self.buf:
200 self.fileobj.write(self.buf)
201 self.buf = ""
268 buf = self._read(self.bufsize)
269 if not buf:
271 t.append(buf)
272 buf = "".join(t)
274 buf = self._read(size)
275 self.pos += len(buf)
277 return buf
288 buf = self.__read(self.bufsize)
289 if not buf:
291 buf = self.cmp.decompress(buf)
292 t.append(buf)
293 c += len(buf)
302 c = len(self.buf)
303 t = [self.buf]
305 buf = self.fileobj.read(self.bufsize)
306 if not buf:
308 t.append(buf)
309 c += len(buf)
311 self.buf = t[size:]
359 buf = self.read(min(size, 100))
360 if not buf:
362 self.linebuffer += buf
363 size -= len(buf)
369 buf = self.linebuffer[:nl]
371 while buf[-1:] == "\r":
372 buf = buf[:-1]
373 return buf + "\n"
451 def frombuf(cls, buf, fileobj, cpiofile=None):
459 if buf[:6] == CMS_ASC:
461 elif buf[:6] == CMS_CHR:
463 elif buf[:6] == CMS_CRC:
466 b = struct.unpack("h", buf[:2])[0]
479 buf += fileobj.read(26 - len(buf))
482 cpioinfo.size) = struct.unpack("=hhHHHHhhihi", buf[:26])
483 buf += fileobj.read(namesize)
484 cpioinfo.name = buf[26:26 + namesize - 1]
488 buf += fileobj.read(namesize % 2)
490 buf += fileobj.read(110 - len(buf))
491 cpioinfo.mode = int(buf[14:22], 16)
492 cpioinfo.uid = int(buf[22:30], 16)
493 cpioinfo.gid = int(buf[30:38], 16)
494 cpioinfo.mtime = int(buf[46:54], 16)
495 cpioinfo.size = int(buf[54:62], 16)
496 cpioinfo.devmajor = int(buf[62:70], 16)
497 cpioinfo.devminor = int(buf[70:78], 16)
498 namesize = int(buf[94:102], 16)
499 cpioinfo.chksum = int(buf[102:110], 16)
500 buf += fileobj.read(namesize)
501 cpioinfo.name = buf[110:110 + namesize - 1]
505 buf += fileobj.read(cpioinfo.hdrsize - 110 - namesize)
824 buf = self.fileobj.read(6)
825 if not buf:
828 cpioinfo = CpioInfo.frombuf(buf, self.fileobj, self)
835 # if cpioinfo.chksum != calc_chksum(buf):