Commit 03a756d8 authored by Quxl's avatar Quxl
parents 83144bc0 637e5fec
......@@ -437,10 +437,42 @@ public class FileUtil {
}
}
}
public static void stringToFileNoLine(File file, String... strings) {
FileOutputStream fos = null;
OutputStreamWriter osw = null;
Writer writer = null;
try {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
fos = new FileOutputStream(file);
osw = new OutputStreamWriter(fos, "UTF-8");
writer = new BufferedWriter(osw);
for (String string : strings) {
writer.append(string);
}
} catch (IOException e) {
throw new FileUtilException(e);
} finally {
try {
writer.close();
osw.close();
fos.close();
} catch (IOException e) {
throw new FileUtilException(e);
}
}
}
public static void stringToFile(String fileFullName, String... strings) {
FileUtil.stringToFile(new File(fileFullName), strings);
}
public static void stringToFileNoLine(String fileFullName, String... strings) {
FileUtil.stringToFileNoLine(new File(fileFullName), strings);
}
public static String fileToString(File file, String charset) {
try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment