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

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

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

Files.contentOf介绍

[英]Loads the text content of a file into a character string.
[中]将文件的文本内容加载到字符串中。

代码示例

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charset the character set to use.
 * @return the content of the file.
 * @throws NullPointerException if the given charset is {@code null}.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, Charset charset) {
 return Files.contentOf(file, charset);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charset the character set to use.
 * @return the content of the file.
 * @throws NullPointerException if the given charset is {@code null}.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, Charset charset) {
 return Files.contentOf(file, charset);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charsetName the name of the character set to use.
 * @return the content of the file.
 * @throws IllegalArgumentException if the given character set is not supported on this platform.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, String charsetName) {
 return Files.contentOf(file, charsetName);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charset the character set to use.
 * @return the content of the file.
 * @throws NullPointerException if the given charset is {@code null}.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, Charset charset) {
 return Files.contentOf(file, charset);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charsetName the name of the character set to use.
 * @return the content of the file.
 * @throws IllegalArgumentException if the given character set is not supported on this platform.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, String charsetName) {
 return Files.contentOf(file, charsetName);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charsetName the name of the character set to use.
 * @return the content of the file.
 * @throws IllegalArgumentException if the given character set is not supported on this platform.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, String charsetName) {
 return Files.contentOf(file, charsetName);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charsetName the name of the character set to use.
 * @return the content of the file.
 * @throws IllegalArgumentException if the given character set is not supported on this platform.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, String charsetName) {
 return Files.contentOf(file, charsetName);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charset the character set to use.
 * @return the content of the file.
 * @throws NullPointerException if the given charset is {@code null}.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, Charset charset) {
 return Files.contentOf(file, charset);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charsetName the name of the character set to use.
 * @return the content of the file.
 * @throws IllegalArgumentException if the given character set is not supported on this platform.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, String charsetName) {
 return Files.contentOf(file, charsetName);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charset the character set to use.
 * @return the content of the file.
 * @throws NullPointerException if the given charset is {@code null}.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, Charset charset) {
 return Files.contentOf(file, charset);
}

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

/**
 * Loads the text content of a file, so that it can be passed to {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @param charsetName the name of the character set to use.
 * @return the content of the file.
 * @throws IllegalArgumentException if the given character set is not supported on this platform.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, String charsetName) {
 return Files.contentOf(file, charsetName);
}

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

/**
 * Loads the text content of a file with the default character set, so that it can be passed to
 * {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @return the content of the file.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file) {
 return Files.contentOf(file, Charset.defaultCharset());
}

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

/**
 * Loads the text content of a file with the default character set, so that it can be passed to
 * {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @return the content of the file.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file) {
 return Files.contentOf(file, Charset.defaultCharset());
}

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

/**
 * Loads the text content of a file with the default character set, so that it can be passed to
 * {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @return the content of the file.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file) {
 return Files.contentOf(file, Charset.defaultCharset());
}

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

/**
 * Loads the text content of a file with the default character set, so that it can be passed to
 * {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @return the content of the file.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file) {
 return Files.contentOf(file, Charset.defaultCharset());
}

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

/**
 * Loads the text content of a file with the default character set, so that it can be passed to
 * {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @return the content of the file.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file) {
 return Files.contentOf(file, Charset.defaultCharset());
}

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

/**
 * Loads the text content of a file with the default character set, so that it can be passed to
 * {@link #assertThat(String)}.
 * <p>
 * Note that this will load the entire file in memory; for larger files, there might be a more efficient alternative
 * with {@link #assertThat(File)}.
 * </p>
 *
 * @param file the file.
 * @return the content of the file.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file) {
 return Files.contentOf(file, Charset.defaultCharset());
}

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

/**
 * Loads the text content of a file into a character string.
 * 
 * @param file the file.
 * @param charsetName the name of the character set to use.
 * @return the content of the file.
 * @throws IllegalArgumentException if the given character set is not supported on this platform.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, String charsetName) {
 checkArgumentCharsetIsSupported(charsetName);
 return contentOf(file, Charset.forName(charsetName));
}

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

/**
 * Loads the text content of a file into a character string.
 * 
 * @param file the file.
 * @param charsetName the name of the character set to use.
 * @return the content of the file.
 * @throws IllegalArgumentException if the given character set is not supported on this platform.
 * @throws UncheckedIOException if an I/O exception occurs.
 */
public static String contentOf(File file, String charsetName) {
 checkArgumentCharsetIsSupported(charsetName);
 return contentOf(file, Charset.forName(charsetName));
}

代码示例来源:origin: SonarSource/sonarqube

private String getNonAsciiAuthor() {
 return Files.contentOf(new File("test-resources/mediumtest/blameAuthor.txt"), StandardCharsets.UTF_8);
}

相关文章