org.assertj.core.util.Files.newFile()方法的使用及代码示例

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

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

Files.newFile介绍

[英]Creates a new file using the given path.
[中]使用给定路径创建新文件。

代码示例

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new file in the system's temporary directory. The name of the file will be the result of:
 * <pre><code class='java'> concat(UUID.randomUUID().toString(), &quot;.txt&quot;);</code></pre>
 * 
 * @return the created file.
 */
public static File newTemporaryFile() {
 String tempFileName = concat(UUID.randomUUID().toString(), ".txt");
 return newFile(concat(temporaryFolderPath(), tempFileName));
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new file in the system's temporary directory. The name of the file will be the result of:
 * <pre><code class='java'> concat(UUID.randomUUID().toString(), &quot;.txt&quot;);</code></pre>
 * 
 * @return the created file.
 */
public static File newTemporaryFile() {
 String tempFileName = concat(UUID.randomUUID().toString(), ".txt");
 return newFile(concat(temporaryFolderPath(), tempFileName));
}

代码示例来源:origin: joel-costigliola/assertj-swing

/**
  * Writes an image as a PNG file to the file system. If there is already a {@code File} present, its contents are
  * discarded.
  * 
  * @param image a {@code BufferedImage} to be written.
  * @param filePath the path of the image file to create.
  * @return {@code false} if the image could not be saved.
  * @exception IOException if an error occurs during writing.
  */
 public boolean writeAsPng(@Nonnull BufferedImage image, @Nonnull String filePath) throws IOException {
  return ImageIO.write(image, PNG, newFile(filePath));
 }
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Creates a new file in the system's temporary directory. The name of the file will be the result of:
 * <p/>
 * 
 * <pre><code class='java'>
 * concat(String.valueOf(System.currentTimeMillis()), &quot;.txt&quot;);
 * </code></pre>
 * 
 * @return the created file.
 */
public static File newTemporaryFile() {
 String tempFileName = concat(valueOf(System.currentTimeMillis()), ".txt");
 return newFile(concat(temporaryFolderPath(), tempFileName));
}

相关文章