cn.hutool.core.io.FileUtil.writeLines()方法的使用及代码示例

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

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

FileUtil.writeLines介绍

[英]将列表写入文件,覆盖模式
[中]将列表写入文件,覆盖模式

代码示例

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param file 文件
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 * @since 4.2.0
 */
public static <T> File writeLines(Collection<T> list, File file, String charset) throws IORuntimeException {
  return writeLines(list, file, charset, false);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File writeLines(Collection<T> list, String path, Charset charset) throws IORuntimeException {
  return writeLines(list, path, charset, false);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,追加模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File appendLines(Collection<T> list, String path, String charset) throws IORuntimeException {
  return writeLines(list, path, charset, true);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File writeLines(Collection<T> list, String path, Charset charset) throws IORuntimeException {
  return writeLines(list, path, charset, false);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,追加模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File appendLines(Collection<T> list, String path, String charset) throws IORuntimeException {
  return writeLines(list, path, charset, true);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,追加模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File appendLines(Collection<T> list, String path, Charset charset) throws IORuntimeException {
  return writeLines(list, path, charset, true);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式,编码为UTF-8
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @return 目标文件
 * @throws IORuntimeException IO异常
 * @since 3.2.0
 */
public static <T> File writeUtf8Lines(Collection<T> list, String path) throws IORuntimeException {
  return writeLines(list, path, CharsetUtil.CHARSET_UTF_8);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式,编码为UTF-8
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @return 目标文件
 * @throws IORuntimeException IO异常
 * @since 3.2.0
 */
public static <T> File writeUtf8Lines(Collection<T> list, String path) throws IORuntimeException {
  return writeLines(list, path, CharsetUtil.CHARSET_UTF_8);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式,编码为UTF-8
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param file 绝对路径
 * @return 目标文件
 * @throws IORuntimeException IO异常
 * @since 3.2.0
 */
public static <T> File writeUtf8Lines(Collection<T> list, File file) throws IORuntimeException {
  return writeLines(list, file, CharsetUtil.CHARSET_UTF_8);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式,编码为UTF-8
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param file 绝对路径
 * @return 目标文件
 * @throws IORuntimeException IO异常
 * @since 3.2.0
 */
public static <T> File writeUtf8Lines(Collection<T> list, File file) throws IORuntimeException {
  return writeLines(list, file, CharsetUtil.CHARSET_UTF_8);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File writeLines(Collection<T> list, String path, String charset) throws IORuntimeException {
  return writeLines(list, path, charset, false);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,追加模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File appendLines(Collection<T> list, String path, Charset charset) throws IORuntimeException {
  return writeLines(list, path, charset, true);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 绝对路径
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File writeLines(Collection<T> list, String path, String charset) throws IORuntimeException {
  return writeLines(list, path, charset, false);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param file 文件
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 * @since 4.2.0
 */
public static <T> File writeLines(Collection<T> list, File file, Charset charset) throws IORuntimeException {
  return writeLines(list, file, charset, false);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,追加模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param file 文件
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 * @since 3.1.2
 */
public static <T> File appendLines(Collection<T> list, File file, String charset) throws IORuntimeException {
  return writeLines(list, file, charset, true);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,追加模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param file 文件
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 * @since 3.1.2
 */
public static <T> File appendLines(Collection<T> list, File file, String charset) throws IORuntimeException {
  return writeLines(list, file, charset, true);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件,覆盖模式
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param file 文件
 * @param charset 字符集
 * @return 目标文件
 * @throws IORuntimeException IO异常
 * @since 4.2.0
 */
public static <T> File writeLines(Collection<T> list, File file, Charset charset) throws IORuntimeException {
  return writeLines(list, file, charset, false);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 文件路径
 * @param charset 字符集
 * @param isAppend 是否追加
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File writeLines(Collection<T> list, String path, String charset, boolean isAppend) throws IORuntimeException {
  return writeLines(list, file(path), charset, isAppend);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 文件路径
 * @param charset 字符集
 * @param isAppend 是否追加
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File writeLines(Collection<T> list, String path, String charset, boolean isAppend) throws IORuntimeException {
  return writeLines(list, file(path), charset, isAppend);
}

代码示例来源:origin: looly/hutool

/**
 * 将列表写入文件
 * 
 * @param <T> 集合元素类型
 * @param list 列表
 * @param path 文件路径
 * @param charset 字符集
 * @param isAppend 是否追加
 * @return 目标文件
 * @throws IORuntimeException IO异常
 */
public static <T> File writeLines(Collection<T> list, String path, Charset charset, boolean isAppend) throws IORuntimeException {
  return writeLines(list, file(path), charset, isAppend);
}

相关文章

微信公众号

最新文章

更多