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: listdir helper
  
  :param files: list of files to fill in
  :param prefix: current location in storage tree (list of names)
  :param node: current node (OleDirectoryEntry object)
  :param streams: bool, include streams if True (True by default) - new in v0.26
  :param storages: bool, include storages if True (False by default) - new in v0.26
      (note: the root storage is never included)
docstr_tok: ["listdir","helper",":","param","files",":","list","of","files","to","fill","in",":","param","prefix",":","current","location","in","storage","tree","(","list","of","names",")",":","param","node",":","current","node","(","OleDirectoryEntry","object",")",":","param","streams",":","bool",",","include","streams","if","True","(","True","by","default",")","-","new","in","v0.26",":","param","storages",":","bool",",","include","storages","if","True","(","False","by","default",")","-","new","in","v0.26","(","note",":","the","root","storage","is","never","included",")"]
code: def _list(self, files, prefix, node, streams=True, storages=False):
      """
      listdir helper
  
      :param files: list of files to fill in
      :param prefix: current location in storage tree (list of names)
      :param node: current node (OleDirectoryEntry object)
      :param streams: bool, include streams if True (True by default) - new in v0.26
      :param storages: bool, include storages if True (False by default) - new in v0.26
          (note: the root storage is never included)
      """
      prefix = prefix + [node.name]
      for entry in node.kids:
          if entry.entry_type == STGTY_STORAGE:
              # this is a storage
              if storages:
                  # add it to the list
                  files.append(prefix[1:] + [entry.name])
              # check its kids
              self._list(files, prefix, entry, streams, storages)
          elif entry.entry_type == STGTY_STREAM:
              # this is a stream
              if streams:
                  # add it to the list
                  files.append(prefix[1:] + [entry.name])
          else:
              self._raise_defect(
                  DEFECT_INCORRECT,
                  "The directory tree contains an entry which is not a stream nor a storage.",
              )
  
imports: from __future__ import print_function
  import io
  import sys
  import struct, array, os.path, datetime, logging
label_desc: Use image node_id 22 for calling the OleFileIO obj's underlying member method code with example usage: obj._list(files, prefix, node, streams, storages) without return types