parameters: (self, cab)
docstring: Called during the constructor run.
  
          Reads the folder headers and initializes the folder's plain stream
          file-like objects.
  
          Yields all folders.
docstring_summary: Called during the constructor run.
docstring_tokens: Called during the constructor run .
function: def read_folder_headers(self, cab):
          """
          Called during the constructor run.
  
          Reads the folder headers and initializes the folder's plain stream
          file-like objects.
  
          Yields all folders.
          """
          # read folder headers
          for _ in range(self.header.cFolders):
              folder = CFFolder.read(cab)
  
              # read reserved
              folder.reserved = read_guaranteed(
                  cab,
                  self.header.reserved_data.cbCFFolder)
  
              # create compressed data stream
              compressed_data_stream = CABFolderStream(
                  cab,
                  folder.coffCabStart,
                  folder.cCFData,
                  self.header.reserved_data.cbCFData)
  
              # determine compression type and create plain data stream
              compression_type = folder.typeCompress & 0x000f
  
              if compression_type == 0:
                  folder.comp_name = "Plain"
                  folder.plain_stream = compressed_data_stream
  
              elif compression_type == 1:
                  raise Exception("MSZIP compression is unsupported")
  
              elif compression_type == 2:
                  raise Exception("Quantum compression is unsupported")
  
              elif compression_type == 3:
                  window_bits = (folder.typeCompress >> 8) & 0x1f
                  folder.comp_name = "LZX (window_bits = %d)" % window_bits
  
                  from .lzxdstream import LZXDStream
                  from ..util.filelike.stream import StreamSeekBuffer
  
                  unseekable_plain_stream = LZXDStream(
                      compressed_data_stream,
                      window_bits=window_bits,
                      reset_interval=0)
  
                  folder.plain_stream = StreamSeekBuffer(unseekable_plain_stream)
  
              else:
                  raise Exception("Unknown compression type %d"
                                  % compression_type)
  
              dbg(folder)
              yield folder
function_tokens: def read_folder_headers ( self , cab ) : # read folder headers for _ in range ( self . header . cFolders ) : folder = CFFolder . read ( cab ) # read reserved folder . reserved = read_guaranteed ( cab , self . header . reserved_data . cbCFFolder ) # create compressed data stream compressed_data_stream = CABFolderStream ( cab , folder . coffCabStart , folder . cCFData , self . header . reserved_data . cbCFData ) # determine compression type and create plain data stream compression_type = folder . typeCompress & 0x000f if compression_type == 0 : folder . comp_name = "Plain" folder . plain_stream = compressed_data_stream elif compression_type == 1 : raise Exception ( "MSZIP compression is unsupported" ) elif compression_type == 2 : raise Exception ( "Quantum compression is unsupported" ) elif compression_type == 3 : window_bits = ( folder . typeCompress >> 8 ) & 0x1f folder . comp_name = "LZX (window_bits = %d)" % window_bits from . lzxdstream import LZXDStream from . . util . filelike . stream import StreamSeekBuffer unseekable_plain_stream = LZXDStream ( compressed_data_stream , window_bits = window_bits , reset_interval = 0 ) folder . plain_stream = StreamSeekBuffer ( unseekable_plain_stream ) else : raise Exception ( "Unknown compression type %d" % compression_type ) dbg ( folder ) yield folder