com.twelvemonkeys.io.FileUtil.rename()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(241)

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

FileUtil.rename介绍

[英]Renames the specified file, if the destination does not exist. If the destination is a directory (and the source is not), the source file is simply moved to the destination directory.
[中]如果目标不存在,则重命名指定的文件。如果目标是目录(而源不是),则只需将源文件移动到目标目录。

代码示例

代码示例来源:origin: haraldk/TwelveMonkeys

/**
 * Renames the specified file, if the destination does not exist.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom The file to rename
 * @param pTo   The new file
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(File pFrom, File pTo) throws IOException {
  return rename(pFrom, pTo, false);
}

代码示例来源:origin: haraldk/TwelveMonkeys

/**
 * Renames the specified file, if the destination does not exist.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom The file to rename
 * @param pTo   The new name of the file
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(File pFrom, String pTo) throws IOException {
  return rename(pFrom, new File(pTo), false);
}

代码示例来源:origin: haraldk/TwelveMonkeys

/**
 * Renames the specified file.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom      The file to rename
 * @param pTo        The new name of the file
 * @param pOverWrite Specifies if the tofile should be overwritten, if it
 *                   exists
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(File pFrom, String pTo, boolean pOverWrite) throws IOException {
  return rename(pFrom, new File(pTo), pOverWrite);
}

代码示例来源:origin: haraldk/TwelveMonkeys

/**
 * Renames the specified file, if the destination does not exist.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom The name of the file to rename
 * @param pTo   The new name of the file
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(String pFrom, String pTo) throws IOException {
  return rename(new File(pFrom), new File(pTo), false);
}

代码示例来源:origin: haraldk/TwelveMonkeys

/**
 * Renames the specified file.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom      The name of the file to rename
 * @param pTo        The new name of the file
 * @param pOverWrite Specifies if the tofile should be overwritten, if it
 *                   exists
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(String pFrom, String pTo, boolean pOverWrite) throws IOException {
  return rename(new File(pFrom), new File(pTo), pOverWrite);
}

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

/**
 * Renames the specified file, if the destination does not exist.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom The file to rename
 * @param pTo   The new file
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(File pFrom, File pTo) throws IOException {
  return rename(pFrom, pTo, false);
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-io

/**
 * Renames the specified file, if the destination does not exist.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom The file to rename
 * @param pTo   The new file
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(File pFrom, File pTo) throws IOException {
  return rename(pFrom, pTo, false);
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-io

/**
 * Renames the specified file.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom      The file to rename
 * @param pTo        The new name of the file
 * @param pOverWrite Specifies if the tofile should be overwritten, if it
 *                   exists
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(File pFrom, String pTo, boolean pOverWrite) throws IOException {
  return rename(pFrom, new File(pTo), pOverWrite);
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-io

/**
 * Renames the specified file, if the destination does not exist.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom The file to rename
 * @param pTo   The new name of the file
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(File pFrom, String pTo) throws IOException {
  return rename(pFrom, new File(pTo), false);
}

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

/**
 * Renames the specified file, if the destination does not exist.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom The file to rename
 * @param pTo   The new name of the file
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(File pFrom, String pTo) throws IOException {
  return rename(pFrom, new File(pTo), false);
}

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

/**
 * Renames the specified file.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom      The file to rename
 * @param pTo        The new name of the file
 * @param pOverWrite Specifies if the tofile should be overwritten, if it
 *                   exists
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(File pFrom, String pTo, boolean pOverWrite) throws IOException {
  return rename(pFrom, new File(pTo), pOverWrite);
}

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

/**
 * Renames the specified file, if the destination does not exist.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom The name of the file to rename
 * @param pTo   The new name of the file
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(String pFrom, String pTo) throws IOException {
  return rename(new File(pFrom), new File(pTo), false);
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-io

/**
 * Renames the specified file, if the destination does not exist.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom The name of the file to rename
 * @param pTo   The new name of the file
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(String pFrom, String pTo) throws IOException {
  return rename(new File(pFrom), new File(pTo), false);
}

代码示例来源:origin: com.github.lafa.twelvemonkeyspurejava.common/common-io

/**
 * Renames the specified file.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom      The name of the file to rename
 * @param pTo        The new name of the file
 * @param pOverWrite Specifies if the tofile should be overwritten, if it
 *                   exists
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(String pFrom, String pTo, boolean pOverWrite) throws IOException {
  return rename(new File(pFrom), new File(pTo), pOverWrite);
}

代码示例来源:origin: com.twelvemonkeys/twelvemonkeys-core

/**
 * Renames the specified file.
 * If the destination is a directory (and the source is not), the source
 * file is simply moved to the destination directory.
 *
 * @param pFrom      The name of the file to rename
 * @param pTo        The new name of the file
 * @param pOverWrite Specifies if the tofile should be overwritten, if it
 *                   exists
 * @return {@code true}, if the file was renamed.
 * @throws java.io.IOException if rename fails
 */
public static boolean rename(String pFrom, String pTo, boolean pOverWrite) throws IOException {
  return rename(new File(pFrom), new File(pTo), pOverWrite);
}

相关文章