Java创建新文件并写入指定的数据
Java的其他文件操作,也会在该专栏更新
1.写入字节数组
/**
* 新建新的文件并写入指定字节数组的数据
* @param fileName 文件目录及名称字符串
* @param bytes 字节数组
* @return 文件
*/
public static File createFile(String fileName, byte[] bytes) {
//参数校验
if (StringUtils.isEmpty(fileName)) {
return null;
}
File newFile = new File(fileName);
try {