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: Open a stream, either in FAT or MiniFAT according to its size.
  (openstream helper)
  
  :param start: index of first sector
  :param size: size of stream (or nothing if size is unknown)
  :param force_FAT: if False (default), stream will be opened in FAT or MiniFAT
      according to size. If True, it will always be opened in FAT.
docstr_tok: ["Open","a","stream",",","either","in","FAT","or","MiniFAT","according","to","its","size",".","(","openstream","helper",")",":","param","start",":","index","of","first","sector",":","param","size",":","size","of","stream","(","or","nothing","if","size","is","unknown",")",":","param","force_FAT",":","if","False","(","default",")",",","stream","will","be","opened","in","FAT","or","MiniFAT","according","to","size",".","If","True",",","it","will","always","be","opened","in","FAT","."]
code: def _open(self, start, size=UNKNOWN_SIZE, force_FAT=False):
      """
      Open a stream, either in FAT or MiniFAT according to its size.
      (openstream helper)
  
      :param start: index of first sector
      :param size: size of stream (or nothing if size is unknown)
      :param force_FAT: if False (default), stream will be opened in FAT or MiniFAT
          according to size. If True, it will always be opened in FAT.
      """
      log.debug(
          "OleFileIO.open(): sect=%Xh, size=%d, force_FAT=%s"
          % (start, size, str(force_FAT))
      )
      # stream size is compared to the mini_stream_cutoff_size threshold:
      if size < self.minisectorcutoff and not force_FAT:
          # ministream object
          if not self.ministream:
              # load MiniFAT if it wasn't already done:
              self.loadminifat()
              # The first sector index of the miniFAT stream is stored in the
              # root directory entry:
              size_ministream = self.root.size
              log.debug(
                  "Opening MiniStream: sect=%Xh, size=%d"
                  % (self.root.isectStart, size_ministream)
              )
              self.ministream = self._open(
                  self.root.isectStart, size_ministream, force_FAT=True
              )
          return OleStream(
              fp=self.ministream,
              sect=start,
              size=size,
              offset=0,
              sectorsize=self.minisectorsize,
              fat=self.minifat,
              filesize=self.ministream.size,
              olefileio=self,
          )
      else:
          # standard stream
          return OleStream(
              fp=self.fp,
              sect=start,
              size=size,
              offset=self.sectorsize,
              sectorsize=self.sectorsize,
              fat=self.fat,
              filesize=self._filesize,
              olefileio=self,
          )
  
imports: from __future__ import print_function
  import io
  import sys
  import struct, array, os.path, datetime, logging
label_desc: Use image node_id 21 for calling the OleFileIO obj's underlying member method code with example usage: obj._open(start, size, force_FAT) and returns: OleStream, OleStream