home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2010 November / maximum-cd-2010-11.iso / DiscContents / calibre-0.7.13.msi / file_2188 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-08-06  |  1018 b   |  33 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import ContainerIO
  5. import string
  6.  
  7. class TarIO(ContainerIO.ContainerIO):
  8.     
  9.     def __init__(self, tarfile, file):
  10.         fh = open(tarfile, 'rb')
  11.         while None:
  12.             s = fh.read(512)
  13.             if len(s) != 512:
  14.                 raise IOError, 'unexpected end of tar file'
  15.             name = s[:100]
  16.             i = string.find(name, chr(0))
  17.             if i == 0:
  18.                 raise IOError, 'cannot find subfile'
  19.             i == 0
  20.             if i > 0:
  21.                 name = name[:i]
  22.             
  23.             size = string.atoi(s[124:136], 8)
  24.             if file == name:
  25.                 break
  26.             
  27.             fh.seek(size + 511 & -512, 1)
  28.             continue
  29.             ContainerIO.ContainerIO.__init__(self, fh, fh.tell(), size)
  30.             return None
  31.  
  32.  
  33.