List of usage examples for org.apache.commons.lang CharEncoding UTF_8
String UTF_8
To view the source code for org.apache.commons.lang CharEncoding UTF_8.
Click Source Link
Eight-bit Unicode Transformation Format.
From source file:org.sonar.plugins.checkstyle.CheckstyleConfiguration.java
public File getXMLDefinitionFile() { Writer writer = null;//from w w w. j a v a 2 s . com File xmlFile = new File(project.getFileSystem().getSonarWorkingDirectory(), "checkstyle.xml"); try { writer = new OutputStreamWriter(new FileOutputStream(xmlFile, false), CharEncoding.UTF_8); confExporter.exportProfile(profile, writer); writer.flush(); return xmlFile; } catch (IOException e) { throw new SonarException("Fail to save the Checkstyle configuration to " + xmlFile.getPath(), e); } finally { IOUtils.closeQuietly(writer); } }
From source file:org.sonar.plugins.checkstyle.CheckstyleConfiguration.java
public Charset getCharset() { Charset charset = project.getFileSystem().getSourceCharset(); if (charset == null) { charset = Charset.forName(System.getProperty("file.encoding", CharEncoding.UTF_8)); }//from w ww. j a va2 s . c om return charset; }
From source file:org.sonar.plugins.ideainspections.IdeaConfiguration.java
public File getXMLDefinitionFile() { Writer writer = null;//from ww w.j av a 2 s . c om File xmlFile = new File(project.getFileSystem().getSonarWorkingDirectory(), CONFIGURATON_FILE); try { writer = new OutputStreamWriter(new FileOutputStream(xmlFile, false), CharEncoding.UTF_8); exporter.exportProfile(profile, writer); writer.flush(); return xmlFile; } catch (IOException e) { throw new SonarException("Fail to save the Idea Inspections configuration to " + xmlFile.getPath(), e); } finally { IOUtils.closeQuietly(writer); } }
From source file:org.sonar.plugins.ideainspections.IdeaConfiguration.java
public Charset getCharset() { Charset charset = project.getFileSystem().getSourceCharset(); if (charset == null) { charset = Charset.forName(System.getProperty("file.encoding", CharEncoding.UTF_8)); }/*from w w w .j ava2s. c om*/ return charset; }
From source file:org.sonar.plugins.ideainspections.rules.IdeaRepository.java
private static String loadDescription(Rule rule) { try {/* www . jav a2 s .c o m*/ final InputStream input = getResourceAsStream("descriptions/" + rule.getKey() + ".html"); return input == null ? null : IOUtils.toString(input, CharEncoding.UTF_8); } catch (IOException e) { return null; } }
From source file:org.sonar.plugins.javascript.jslint.JsLintXmlRuleParser.java
public List<JsLintRule> parse(File file) { Reader reader = null;/*from www .j a v a 2 s . c o m*/ try { reader = new InputStreamReader(FileUtils.openInputStream(file), CharEncoding.UTF_8); return parse(reader); } catch (IOException e) { throw new SonarException("Fail to load the file: " + file, e); } finally { IOUtils.closeQuietly(reader); } }
From source file:org.sonar.plugins.javascript.jslint.JsLintXmlRuleParser.java
/** * Warning : the input stream is closed in this method */// ww w . j a va2s . co m public List<JsLintRule> parse(InputStream input) { Reader reader = null; try { reader = new InputStreamReader(input, CharEncoding.UTF_8); return parse(reader); } catch (IOException e) { throw new SonarException("Fail to load the xml stream", e); } finally { IOUtils.closeQuietly(reader); } }
From source file:org.sonar.plugins.objectivec.violations.OCLintRuleRepository.java
@Override public List<Rule> createRules() { BufferedReader reader = null; try {//from w ww.j a va 2 s.c om reader = new BufferedReader( new InputStreamReader(getClass().getResourceAsStream(RULES_FILE), CharEncoding.UTF_8)); return ocLintRuleParser.parse(reader); } catch (final IOException e) { throw new SonarException("Fail to load the default OCLint rules.", e); } finally { Closeables.closeQuietly(reader); } }
From source file:org.sonar.plugins.php.checkstyle.xml.Module.java
/** * From xml.// ww w . j a va 2 s.c o m * * @param xml * the xml * * @return the module */ public Module fromXml(String xml) { InputStream input = null; try { input = IOUtils.toInputStream(xml, CharEncoding.UTF_8); return (Module) newXStream().fromXML(input); } catch (IOException e) { throw new PhpPluginExecutionException("can't read configuration file", e); } finally { IOUtils.closeQuietly(input); } }
From source file:org.sonar.plugins.php.codesniffer.PhpCodeSnifferConfiguration.java
/** * @return The temporary rulest file passed to phpcs to run only sniff for the ruleset. *//*from w w w. j a v a2 s . co m*/ public File getRuleSet() { Writer writer = null; File xmlFile = new File(project.getFileSystem().getSonarWorkingDirectory(), PHP_CODESNIFFER_TMP_RULESET_FILENAME); try { writer = new OutputStreamWriter(new FileOutputStream(xmlFile, false), CharEncoding.UTF_8); exporter.exportProfile(profile, writer); writer.flush(); return xmlFile; } catch (IOException e) { throw new SonarException("Fail to export temporary ruleset file to " + xmlFile.getPath(), e); } finally { IOUtils.closeQuietly(writer); } }