读文件
public static String[] readFilePram(String filename) throws IOException {
FileReader fr = new FileReader(filename);
BufferedReader br = new BufferedReader(fr);
String line;
String[] args = null;
while ((line = br.readLine()) != null) {
args = line.split(",");
}
br.close();
fr.close();
return args;
}
写文件
publi static void writeFilePram(String dir, String filename, String content) throws IOException {
File file = new File(dir + filename);
FileOutputStream fw = null;
if (!file.exists()) {
file.createNewFile();
fw = new FileOutputStream(file);
} else {
fw = new FileOutputStream(file, true);
}
OutputStreamWriter bw = new OutputStreamWriter(fw, "UTF-8");
bw.write( content + "
");
bw.close();
fw.close();
}