class_docstr: OLE container object
  
  This class encapsulates the interface to an OLE 2 structured
  storage file.  Use the listdir and openstream methods to
  access the contents of this file.
  
  Object names are given as a list of strings, one for each subentry
  level.  The root entry should be omitted.  For example, the following
  code extracts all image streams from a Microsoft Image Composer file::
  
      ole = OleFileIO("fan.mic")
  
      for entry in ole.listdir():
          if entry[1:2] == "Image":
              fin = ole.openstream(entry)
              fout = open(entry[0:1], "wb")
              while True:
                  s = fin.read(8192)
                  if not s:
                      break
                  fout.write(s)
  
  You can use the viewer application provided with the Python Imaging
  Library to view the resulting files (which happens to be standard
  TIFF files).
class_docstr_tok: ["OLE","container","object","This","class","encapsulates","the","interface","to","an","OLE","2","structured","storage","file",".","Use","the","listdir","and","openstream","methods","to","access","the","contents","of","this","file",".","Object","names","are","given","as","a","list","of","strings",",","one","for","each","subentry","level",".","The","root","entry","should","be","omitted",".","For","example",",","the","following","code","extracts","all","image","streams","from","a","Microsoft","Image","Composer","file",":",":","ole","=","OleFileIO","(","``","fan.mic","''",")","for","entry","in","ole.listdir","(",")",":","if","entry","[","1:2","]","==","``","Image","''",":","fin","=","ole.openstream","(","entry",")","fout","=","open","(","entry","[","0:1","]",",","``","wb","''",")","while","True",":","s","=","fin.read","(","8192",")","if","not","s",":","break","fout.write","(","s",")","You","can","use","the","viewer","application","provided","with","the","Python","Imaging","Library","to","view","the","resulting","files","(","which","happens","to","be","standard","TIFF","files",")","."]
docstr: Load the directory.
  
  :param sect: sector index of directory stream.
docstr_tok: ["Load","the","directory",".",":","param","sect",":","sector","index","of","directory","stream","."]
code: def loaddirectory(self, sect):
      """
      Load the directory.
  
      :param sect: sector index of directory stream.
      """
      log.debug("Loading the Directory:")
      # The directory is  stored in a standard
      # substream, independent of its size.
  
      # open directory stream as a read-only file:
      # (stream size is not known in advance)
      self.directory_fp = self._open(sect, force_FAT=True)
  
      # [PL] to detect malformed documents and avoid DoS attacks, the maximum
      # number of directory entries can be calculated:
      max_entries = self.directory_fp.size // 128
      log.debug(
          "loaddirectory: size=%d, max_entries=%d"
          % (self.directory_fp.size, max_entries)
      )
  
      # Create list of directory entries
      # self.direntries = []
      # We start with a list of "None" object
      self.direntries = [None] * max_entries
      ##        for sid in iterrange(max_entries):
      ##            entry = fp.read(128)
      ##            if not entry:
      ##                break
      ##            self.direntries.append(OleDirectoryEntry(entry, sid, self))
      # load root entry:
      root_entry = self._load_direntry(0)
      # Root entry is the first entry:
      self.root = self.direntries[0]
      # TODO: read ALL directory entries (ignore bad entries?)
      # TODO: adapt build_storage_tree to avoid duplicate reads
      # for i in range(1, max_entries):
      #     self._load_direntry(i)
      # read and build all storage trees, starting from the root:
      self.root.build_storage_tree()
  
imports: from __future__ import print_function
  import io
  import sys
  import struct, array, os.path, datetime, logging
label_desc: Use image node_id 18 for calling the OleFileIO obj's underlying member method code with example usage: obj.loaddirectory(sect) without return types