我们如何修复Reliance on default encoding
findBugs 报告的问题:
StringBuffer printData = getPrintData(data);
try {
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(new File(linkName)));
out.write(printData.toString());
out.flush();
final FileInputStream f = new FileInputStream(new File(linkName));
return f;
} catch (final IOException ioe) {
ioe.printStackTrace();
}
我正在使用StreamWriter
.