📅  最后修改于: 2022-03-11 14:52:39.593000             🧑  作者: Mango
public static Writer createOutputWriter(String fileNm) {
OutputStream os;
if (fileNm.equals("") ) { // No file name provided, write to console
os = System.out;
}
// File name provided, write to this file name
else {
try {
os = new FileOutputStream(fileNm);
}
catch (FileNotFoundException fe) {
System.out.println("File not found " + fe.toString());
}
}
return new BufferedWriter(new OutputStreamWriter(os));
}