/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }
@Override public String getEncoding() { if(!MockFramework.isEnabled()){ return super.getEncoding(); } return stream.getEncoding(); }