@Nonnull public Charset getCharacterEncodingObjOrDefault () { Charset ret = getCharacterEncodingObj (); if (ret == null) ret = SystemHelper.getSystemCharset (); return ret; }
@Nonnull public Charset getCharacterEncodingObjOrDefault () { Charset ret = getCharacterEncodingObj (); if (ret == null) ret = SystemHelper.getSystemCharset (); return ret; }
public static void main (final String [] args) throws Exception { final Map <String, Object> map = new HashMap <> (); map.put ("falseArg", Boolean.FALSE); map.put ("trueArg", Boolean.TRUE); map.put ("stringValue", "someString"); try (final Writer aWriter = FileHelper.getBufferedWriter (new File (args[1]), SystemHelper.getSystemCharset ())) { new OutputFileGenerator (args[0], map).generate (aWriter); } }
/** * @return The charset configured via {@link #ATTR_CHARSET} parameter or the * system default. Never <code>null</code>. */ @Nonnull protected Charset getCharset () { final String sCharsetName = attrs ().getAsString (ATTR_CHARSET); final Charset aCharset = CharsetHelper.getCharsetFromNameOrNull (sCharsetName); return aCharset != null ? aCharset : SystemHelper.getSystemCharset (); }
/** * Return the file encoding for reading grammars; this will return the * file.encoding system property if no value was explicitly set * * @return The file encoding (e.g., UTF-8, ISO_8859-1, MacRoman) */ @Nonnull public static Charset getGrammarEncoding () { final String sValue = stringValue (USEROPTION__GRAMMAR_ENCODING); if (StringHelper.hasText (sValue)) try { return Charset.forName (sValue); } catch (final UnsupportedCharsetException ex) { // Fall through JavaCCErrors.warning ("The grammar encoding value '" + sValue + "' is invalid. Falling back to default."); } return SystemHelper.getSystemCharset (); }
SystemHelper.getSystemCharset ()); return aBAOS.getAsString (aCharsetToUse);
Integer.toString (SystemHelper.getNumberOfProcessors ())); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_CHARSET.getDisplayText (aDisplayLocale), SystemHelper.getSystemCharset ().toString ()); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_LOCALE.getDisplayText (aDisplayLocale), SystemHelper.getSystemLocale ().toString ());
Integer.toString (SystemHelper.getNumberOfProcessors ())); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_CHARSET.getDisplayText (aDisplayLocale), SystemHelper.getSystemCharset ().toString ()); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_LOCALE.getDisplayText (aDisplayLocale), SystemHelper.getSystemLocale ().toString ());
Integer.toString (SystemHelper.getNumberOfProcessors ())); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_CHARSET.getDisplayText (aDisplayLocale), SystemHelper.getSystemCharset ().toString ()); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_LOCALE.getDisplayText (aDisplayLocale), SystemHelper.getSystemLocale ().toString ());