public FileOutputStream startWrite()

in simplestore/src/main/java/com/uber/simplestore/impl/AtomicFile.java [88:106]


  public FileOutputStream startWrite() throws IOException {
    if (mLegacyBackupName.exists()) {
      rename(mLegacyBackupName, mBaseName);
    }

    try {
      return new FileOutputStream(mNewName);
    } catch (FileNotFoundException e) {
      File parent = mNewName.getParentFile();
      if (!parent.mkdirs()) {
        throw new IOException("Failed to create directory for " + mNewName);
      }
      try {
        return new FileOutputStream(mNewName);
      } catch (FileNotFoundException e2) {
        throw new IOException("Failed to create new file " + mNewName, e2);
      }
    }
  }