@Override
  public Inserter insert(String resourceId, Object debugInfo) throws IOException {
    // ensure that the parent directory exists
    FileInfo info = new FileInfo(FileType.TEMP, resourceId);
    File parent = getSubdirectory(info.resourceId);
    if (!parent.exists()) {
      mkdirs(parent, "insert");
    }

    try {
      File file = info.createTempFile(parent);
      return new InserterImpl(resourceId, file);
    } catch (IOException ioe) {
      mCacheErrorLogger.logError(
          CacheErrorLogger.CacheErrorCategory.WRITE_CREATE_TEMPFILE, TAG, "insert", ioe);
      throw ioe;
    }
  }
Creates the directory (and its parents, if necessary). In case of an exception, log an error
message with the relevant parameters

@param directory the directory to create
@param message message to use
@throws IOException
imagepipeline-base/src/main/java/com/facebook/cache/disk/DefaultDiskStorage.java