本文整理了Java中java.io.FileWriter.getEncoding()
方法的一些代码示例,展示了FileWriter.getEncoding()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileWriter.getEncoding()
方法的具体详情如下:
包路径:java.io.FileWriter
类名称:FileWriter
方法名:getEncoding
暂无
代码示例来源:origin: bobbylight/RSyntaxTextArea
/**
* Returns the default encoding for this operating system.
*
* @return The default encoding.
*/
private static String getDefaultEncoding() {
// NOTE: The "file.encoding" system property is not guaranteed to be
// set by the spec, so we cannot rely on it.
String encoding = Charset.defaultCharset().name();
if (encoding==null) {
try {
File f = File.createTempFile("rsta", null);
FileWriter w = new FileWriter(f);
encoding = w.getEncoding();
w.close();
f.deleteOnExit();//delete(); Keep FindBugs happy
} catch (IOException ioe) {
encoding = "US-ASCII";
}
}
return encoding;
}
代码示例来源:origin: org.codehaus.jtstand/jtstand-editor
/**
* Returns the default encoding for this operating system.
*
* @return The default encoding.
*/
private static final String getDefaultEncoding() {
// TODO: Change to "Charset.defaultCharset().name()" when 1.4 support
// is no longer needed.
// NOTE: The "file.encoding" property is not guaranteed to be set by
// the spec, so we cannot rely on it.
String encoding = System.getProperty("file.encoding");
if (encoding==null) {
try {
File f = File.createTempFile("rsta", null);
FileWriter w = new FileWriter(f);
encoding = w.getEncoding();
w.close();
f.deleteOnExit();//delete(); Keep FindBugs happy
} catch (IOException ioe) {
encoding = "US-ASCII";
}
}
return encoding;
}
代码示例来源:origin: com.fifesoft/rsyntaxtextarea
/**
* Returns the default encoding for this operating system.
*
* @return The default encoding.
*/
private static String getDefaultEncoding() {
// NOTE: The "file.encoding" system property is not guaranteed to be
// set by the spec, so we cannot rely on it.
String encoding = Charset.defaultCharset().name();
if (encoding==null) {
try {
File f = File.createTempFile("rsta", null);
FileWriter w = new FileWriter(f);
encoding = w.getEncoding();
w.close();
f.deleteOnExit();//delete(); Keep FindBugs happy
} catch (IOException ioe) {
encoding = "US-ASCII";
}
}
return encoding;
}
代码示例来源:origin: org.nuiton.thirdparty/rsyntaxtextarea
/**
* Returns the default encoding for this operating system.
*
* @return The default encoding.
*/
private static final String getDefaultEncoding() {
// TODO: Change to "Charset.defaultCharset().name()" when 1.4 support
// is no longer needed.
// NOTE: The "file.encoding" property is not guaranteed to be set by
// the spec, so we cannot rely on it.
String encoding = System.getProperty("file.encoding");
if (encoding==null) {
try {
File f = File.createTempFile("rsta", null);
FileWriter w = new FileWriter(f);
encoding = w.getEncoding();
w.close();
f.deleteOnExit();//delete(); Keep FindBugs happy
} catch (IOException ioe) {
encoding = "US-ASCII";
}
}
return encoding;
}
代码示例来源:origin: EvoSuite/evosuite
@Override
public String getEncoding() {
if(!MockFramework.isEnabled()){
return super.getEncoding();
}
return stream.getEncoding();
}
内容来源于网络,如有侵权,请联系作者删除!