@Nonnull public Charset getCharacterEncodingObjOrDefault () { Charset ret = getCharacterEncodingObj (); if (ret == null) ret = SystemHelper.getSystemCharset (); return ret; }
SystemHelper.getOperatingSystem ().getDisplayName () + " / " + SystemHelper.getOperatingSystemName ()); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_NUM_PROCESSORS.getDisplayText (aDisplayLocale), 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 ()); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_MEM_FREE.getDisplayText (aDisplayLocale), Long.toString (SystemHelper.getFreeMemory ()) + " / " + aSH.getAsMatching (SystemHelper.getFreeMemory (), 2)); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_MEM_MAX.getDisplayText (aDisplayLocale), Long.toString (SystemHelper.getMaxMemory ()) + " / " + aSH.getAsMatching (SystemHelper.getMaxMemory (), 2)); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_MEM_TOTAL.getDisplayText (aDisplayLocale), Long.toString (SystemHelper.getTotalMemory ()) + " / " + aSH.getAsMatching (SystemHelper.getTotalMemory (), 2)); aTable.addBodyRow ().addCells (EText.MSG_CONTEXT_CLASSLOADER.getDisplayText (aDisplayLocale), ClassHelper.getContextClassLoader ().toString ());
protected final void logThirdpartyModules () { // List all third party modules for later evaluation final ICommonsSet <IThirdPartyModule> aModules = ThirdPartyModuleRegistry.getInstance () .getAllRegisteredThirdPartyModules (); if (!aModules.isEmpty ()) { LOGGER.info ("Using the following third party modules:"); for (final IThirdPartyModule aModule : aModules.getSorted (IHasDisplayName.getComparatorCollating (SystemHelper.getSystemLocale ()))) if (!aModule.isOptional ()) { String sMsg = " " + aModule.getDisplayName (); if (aModule.getVersion () != null) sMsg += ' ' + aModule.getVersion ().getAsString (true); sMsg += " licensed under " + aModule.getLicense ().getDisplayName (); if (aModule.getLicense ().getVersion () != null) sMsg += ' ' + aModule.getLicense ().getVersion ().getAsString (); LOGGER.info (sMsg); } } }
SystemHelper.getOperatingSystem ().getDisplayName () + " / " + SystemHelper.getOperatingSystemName ()); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_NUM_PROCESSORS.getDisplayText (aDisplayLocale), 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 ()); aTable.addBodyRow () .addCells (EText.MSG_SYSTEM_MEM_FREE.getDisplayText (aDisplayLocale), Long.toString (SystemHelper.getFreeMemory ()) + " / " + aSH.getAsMatching (SystemHelper.getFreeMemory (), 2)); aTable.addBodyRow () .addCells (EText.MSG_SYSTEM_MEM_MAX.getDisplayText (aDisplayLocale), Long.toString (SystemHelper.getMaxMemory ()) + " / " + aSH.getAsMatching (SystemHelper.getMaxMemory (), 2)); aTable.addBodyRow () .addCells (EText.MSG_SYSTEM_MEM_TOTAL.getDisplayText (aDisplayLocale), Long.toString (SystemHelper.getTotalMemory ()) + " / " + aSH.getAsMatching (SystemHelper.getTotalMemory (), 2)); aTable.addBodyRow ().addCells (EText.MSG_CONTEXT_CLASSLOADER.getDisplayText (aDisplayLocale),
SystemHelper.getOperatingSystem ().getDisplayName () + " / " + SystemHelper.getOperatingSystemName ()); aTable.addBodyRow ().addCells (EText.MSG_SYSTEM_NUM_PROCESSORS.getDisplayText (aDisplayLocale), 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 ()); aTable.addBodyRow () .addCells (EText.MSG_SYSTEM_MEM_FREE.getDisplayText (aDisplayLocale), Long.toString (SystemHelper.getFreeMemory ()) + " / " + aSH.getAsMatching (SystemHelper.getFreeMemory (), 2)); aTable.addBodyRow () .addCells (EText.MSG_SYSTEM_MEM_MAX.getDisplayText (aDisplayLocale), Long.toString (SystemHelper.getMaxMemory ()) + " / " + aSH.getAsMatching (SystemHelper.getMaxMemory (), 2)); aTable.addBodyRow () .addCells (EText.MSG_SYSTEM_MEM_TOTAL.getDisplayText (aDisplayLocale), Long.toString (SystemHelper.getTotalMemory ()) + " / " + aSH.getAsMatching (SystemHelper.getTotalMemory (), 2)); aTable.addBodyRow ().addCells (EText.MSG_CONTEXT_CLASSLOADER.getDisplayText (aDisplayLocale),
@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);