java.io.File.mkdirErrno()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中java.io.File.mkdirErrno()方法的一些代码示例,展示了File.mkdirErrno()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。File.mkdirErrno()方法的具体详情如下:
包路径:java.io.File
类名称:File
方法名:mkdirErrno

File.mkdirErrno介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Creates the directory named by this file, assuming its parents exist.
 * Use {@link #mkdirs} if you also want to create missing parents.
 *
 * <p>Note that this method does <i>not</i> throw {@code IOException} on failure.
 * Callers must check the return value. Note also that this method returns
 * false if the directory already existed. If you want to know whether the
 * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())}
 * or simply ignore the return value from this method and simply call {@link #isDirectory}.
 *
 * @return {@code true} if the directory was created,
 *         {@code false} on failure or if the directory already existed.
 */
public boolean mkdir() {
  try {
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    return false;
  }
}

代码示例来源:origin: robovm/robovm

private boolean mkdirs(boolean resultIfExists) {
  try {
    // Try to create the directory directly.
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == ENOENT) {
      // If the parent was missing, try to create it and then try again.
      File parent = getParentFile();
      return parent != null && parent.mkdirs(true) && mkdir();
    } else if (errnoException.errno == EEXIST) {
      return resultIfExists;
    }
    return false;
  }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Creates the directory named by this file, assuming its parents exist.
 * Use {@link #mkdirs} if you also want to create missing parents.
 *
 * <p>Note that this method does <i>not</i> throw {@code IOException} on failure.
 * Callers must check the return value. Note also that this method returns
 * false if the directory already existed. If you want to know whether the
 * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())}
 * or simply ignore the return value from this method and simply call {@link #isDirectory}.
 *
 * @return {@code true} if the directory was created,
 *         {@code false} on failure or if the directory already existed.
 */
public boolean mkdir() {
  try {
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    return false;
  }
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Creates the directory named by this file, assuming its parents exist.
 * Use {@link #mkdirs} if you also want to create missing parents.
 *
 * <p>Note that this method does <i>not</i> throw {@code IOException} on failure.
 * Callers must check the return value. Note also that this method returns
 * false if the directory already existed. If you want to know whether the
 * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())}
 * or simply ignore the return value from this method and simply call {@link #isDirectory}.
 *
 * @return {@code true} if the directory was created,
 *         {@code false} on failure or if the directory already existed.
 */
public boolean mkdir() {
  try {
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    return false;
  }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Creates the directory named by this file, assuming its parents exist.
 * Use {@link #mkdirs} if you also want to create missing parents.
 *
 * <p>Note that this method does <i>not</i> throw {@code IOException} on failure.
 * Callers must check the return value. Note also that this method returns
 * false if the directory already existed. If you want to know whether the
 * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())}
 * or simply ignore the return value from this method and simply call {@link #isDirectory}.
 *
 * @return {@code true} if the directory was created,
 *         {@code false} on failure or if the directory already existed.
 */
public boolean mkdir() {
  try {
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    return false;
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Creates the directory named by this file, assuming its parents exist.
 * Use {@link #mkdirs} if you also want to create missing parents.
 *
 * <p>Note that this method does <i>not</i> throw {@code IOException} on failure.
 * Callers must check the return value. Note also that this method returns
 * false if the directory already existed. If you want to know whether the
 * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())}
 * or simply ignore the return value from this method and simply call {@link #isDirectory}.
 *
 * @return {@code true} if the directory was created,
 *         {@code false} on failure or if the directory already existed.
 */
public boolean mkdir() {
  try {
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    return false;
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Creates the directory named by this file, assuming its parents exist.
 * Use {@link #mkdirs} if you also want to create missing parents.
 *
 * <p>Note that this method does <i>not</i> throw {@code IOException} on failure.
 * Callers must check the return value. Note also that this method returns
 * false if the directory already existed. If you want to know whether the
 * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())}
 * or simply ignore the return value from this method and simply call {@link #isDirectory}.
 *
 * @return {@code true} if the directory was created,
 *         {@code false} on failure or if the directory already existed.
 */
public boolean mkdir() {
  try {
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    return false;
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

/**
 * Creates the directory named by this file, assuming its parents exist.
 * Use {@link #mkdirs} if you also want to create missing parents.
 *
 * <p>Note that this method does <i>not</i> throw {@code IOException} on failure.
 * Callers must check the return value. Note also that this method returns
 * false if the directory already existed. If you want to know whether the
 * directory exists on return, either use {@code (f.mkdir() || f.isDirectory())}
 * or simply ignore the return value from this method and simply call {@link #isDirectory}.
 *
 * @return {@code true} if the directory was created,
 *         {@code false} on failure or if the directory already existed.
 */
public boolean mkdir() {
  try {
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    return false;
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

private boolean mkdirs(boolean resultIfExists) {
  try {
    // Try to create the directory directly.
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == ENOENT) {
      // If the parent was missing, try to create it and then try again.
      File parent = getParentFile();
      return parent != null && parent.mkdirs(true) && mkdir();
    } else if (errnoException.errno == EEXIST) {
      return resultIfExists;
    }
    return false;
  }
}

代码示例来源:origin: MobiVM/robovm

private boolean mkdirs(boolean resultIfExists) {
  try {
    // Try to create the directory directly.
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == ENOENT) {
      // If the parent was missing, try to create it and then try again.
      File parent = getParentFile();
      return parent != null && parent.mkdirs(true) && mkdir();
    } else if (errnoException.errno == EEXIST) {
      return resultIfExists;
    }
    return false;
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

private boolean mkdirs(boolean resultIfExists) {
  try {
    // Try to create the directory directly.
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == ENOENT) {
      // If the parent was missing, try to create it and then try again.
      File parent = getParentFile();
      return parent != null && parent.mkdirs(true) && mkdir();
    } else if (errnoException.errno == EEXIST) {
      return resultIfExists;
    }
    return false;
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

private boolean mkdirs(boolean resultIfExists) {
  try {
    // Try to create the directory directly.
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == ENOENT) {
      // If the parent was missing, try to create it and then try again.
      File parent = getParentFile();
      return parent != null && parent.mkdirs(true) && mkdir();
    } else if (errnoException.errno == EEXIST) {
      return resultIfExists;
    }
    return false;
  }
}

代码示例来源:origin: ibinti/bugvm

private boolean mkdirs(boolean resultIfExists) {
  try {
    // Try to create the directory directly.
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == ENOENT) {
      // If the parent was missing, try to create it and then try again.
      File parent = getParentFile();
      return parent != null && parent.mkdirs(true) && mkdir();
    } else if (errnoException.errno == EEXIST) {
      return resultIfExists;
    }
    return false;
  }
}

代码示例来源:origin: FlexoVM/flexovm

private boolean mkdirs(boolean resultIfExists) {
  try {
    // Try to create the directory directly.
    mkdirErrno();
    return true;
  } catch (ErrnoException errnoException) {
    if (errnoException.errno == ENOENT) {
      // If the parent was missing, try to create it and then try again.
      File parent = getParentFile();
      return parent != null && parent.mkdirs(true) && mkdir();
    } else if (errnoException.errno == EEXIST) {
      return resultIfExists;
    }
    return false;
  }
}

相关文章