Files
JDK7使用Files代替了File————————————>NIO代替常规得IO
创建目录
Path parPath = null;
parPath = Files.createDirectories(Paths.get(localFilePath)); localFilePath为文件存储地址
创建文件
Path path = Files.createTempFile(parPath, null, null);
BufferedWriter outputStream = Files.newBufferedWriter(path, StandardCharsets.UTF_8);
写入内容
outputStream.write(“要写入得内容”);
outputStream.newLine();//换行
outputStream.flush();//刷新缓存区
Files.delete(path);//删除原文件