@Test public void testCheckEncoding() throws Exception { Path tempFile = Files.createTempFile("", ""); Files.writeString(tempFile, "nuxéo", StandardCharsets.UTF_8, StandardOpenOption.CREATE); try { Charset charset = ConfigurationGenerator.checkFileCharset(tempFile.toFile()); assertEquals(StandardCharsets.UTF_8, charset); } finally { Files.deleteIfExists(tempFile); } Files.writeString(tempFile, "nuxéo", StandardCharsets.ISO_8859_1, StandardOpenOption.CREATE); try { Charset charset = ConfigurationGenerator.checkFileCharset(tempFile.toFile()); assertEquals(StandardCharsets.ISO_8859_1, charset); } finally { Files.deleteIfExists(tempFile); } Files.writeString(tempFile, "nuxeo", StandardCharsets.US_ASCII, StandardOpenOption.CREATE); try { Charset charset = ConfigurationGenerator.checkFileCharset(tempFile.toFile()); assertEquals(StandardCharsets.US_ASCII, charset); } finally { Files.deleteIfExists(tempFile); } }
public static Charset checkFileCharset(File propsFile) throws IOException { List<Charset> charsetsToBeTested = asList(US_ASCII, UTF_8, ISO_8859_1); for (Charset charsetTest : charsetsToBeTested) { CharsetDecoder decoder = charsetTest.newDecoder(); decoder.reset(); boolean identified = true; try (BufferedInputStream input = new BufferedInputStream(new FileInputStream(propsFile))) { byte[] buffer = new byte[512]; while (input.read(buffer) != -1 && identified) { try { decoder.decode(ByteBuffer.wrap(buffer)); identified = true; } catch (CharacterCodingException e) { identified = false; } } } if (identified) { return charsetTest; } } return null; }
ConfigurationGenerator { public static Charset checkFileCharset(File propsFile) throws IOException { List<Charset> charsetsToBeTested = asList(US_ASCII, UTF_8, ISO_8859_1); for (Charset charsetTest : charsetsToBeTested) { CharsetDecoder decoder = charsetTest.newDecoder(); decoder.reset(); boolean identified = true; try (BufferedInputStream input = new BufferedInputStream(new FileInputStream(propsFile))) { byte[] buffer = new byte[512]; while (input.read(buffer) != -1 && identified) { try { decoder.decode(ByteBuffer.wrap(buffer)); identified = true; } catch (CharacterCodingException e) { identified = false; } } } if (identified) { return charsetTest; } } return null; } }
ConfigurationGenerator { public static Charset checkFileCharset(File propsFile) throws IOException { List<Charset> charsetsToBeTested = asList(US_ASCII, UTF_8, ISO_8859_1); for (Charset charsetTest : charsetsToBeTested) { CharsetDecoder decoder = charsetTest.newDecoder(); decoder.reset(); boolean identified = true; try (BufferedInputStream input = new BufferedInputStream(new FileInputStream(propsFile))) { byte[] buffer = new byte[512]; while (input.read(buffer) != -1 && identified) { try { decoder.decode(ByteBuffer.wrap(buffer)); identified = true; } catch (CharacterCodingException e) { identified = false; } } } if (identified) { return charsetTest; } } return null; } ConfigurationGenerator();  ConfigurationGenerator(boolean quiet, boolean debug); }
ConfigurationGenerator { public static Charset checkFileCharset(File propsFile) throws IOException { List<Charset> charsetsToBeTested = asList(US_ASCII, UTF_8, ISO_8859_1); for (Charset charsetTest : charsetsToBeTested) { CharsetDecoder decoder = charsetTest.newDecoder(); decoder.reset(); boolean identified = true; try (BufferedInputStream input = new BufferedInputStream(new FileInputStream(propsFile))) { byte[] buffer = new byte[512]; while (input.read(buffer) != -1 && identified) { try { decoder.decode(ByteBuffer.wrap(buffer)); identified = true; } catch (CharacterCodingException e) { identified = false; } } } if (identified) { return charsetTest; } } return null; } ConfigurationGenerator();  ConfigurationGenerator(boolean quiet, boolean debug); boolean isConfigurable(); void hideDeprecationWarnings(boolean hide); void setForceGeneration(boolean forceGeneration); boolean isForceGeneration(); CryptoProperties getUserConfig(); final ServerConfigurator getServerConfigurator(); void run(); boolean init(); boolean init(boolean forceReload); String changeTemplates(String newTemplates); void changeDBTemplate(String dbTemplate); void setDirectoryWithProperty(String key); String getUserTemplates(); File getNuxeoHome(); File getNuxeoBinDir(); @Deprecated(since = "11.1") File getNuxeoDefaultConf(); List<File> getIncludedTemplates(); void saveConfiguration(Map<String, String> changedParameters); void saveConfiguration(Map<String, String> changedParameters, boolean setGenerationOnceToFalse,
            boolean setGenerationFalseToOnce); void saveFilteredConfiguration(Map<String, String> changedParameters); Map<String, String> getChangedParameters(Map<String, String> changedParameters); String extractDatabaseTemplateName(); String extractSecondaryDatabaseTemplateName(); File getNuxeoConf(); void initLogs(); File getLogDir(); File getPidDir(); File getDataDir(); void verifyInstallation(); void checkJavaVersion(); static boolean checkJavaVersion(String version, String requiredVersion); void checkAddressesAndPorts(); InetAddress getBindAddress(); static InetAddress getBindAddress(String hostName); static void checkAddressReachable(InetAddress address); static void checkPortAvailable(InetAddress address, int port); File getTmpDir(); List<String> getLogFiles(); String rebuildTemplatesStr(String dbTemplate); File getConfigDir(); File getRuntimeHome(); boolean isInstallInProgress(); @Deprecated(since = "11.1") File getDistributionMPDir(); File getInstallFile(); void addTemplate(String templatesToAdd); List<String> getTemplateList(); void rmTemplate(String templatesToRm); String setProperty(String key, String value); Map<String, String> setProperties(Map<String, String> newParametersToSave); Map<String, String> setProperties(String template, Map<String, String> newParametersToSave); void checkDatabaseConnection(String databaseTemplate, String dbName, String dbUser, String dbPassword,
            String dbHost, String dbPort); Environment getEnv(); static Charset checkFileCharset(File propsFile); static Properties loadTrimmedProperties(File propsFile); static void loadTrimmedProperties(Properties props, InputStreamReader propsIS); File getDumpedConfig(); Hashtable<Object, Object> getContextEnv(String ldapUrl, String bindDn, String bindPassword,
            boolean checkAuthentication); void checkLdapConnection(String ldapUrl, String ldapBindDn, String ldapBindPwd, boolean authenticate); void checkLdapConnection(Hashtable<Object, Object> contextEnv); Crypto getCrypto(); @Deprecated(since = "11.1") File getTemplateConf(String template); File getTemplateDirectory(String template); List<String> getJavaOpts(Function<String, String> mapper); }
ConfigurationGenerator { public static Charset checkFileCharset(File propsFile) throws IOException { List<Charset> charsetsToBeTested = asList(US_ASCII, UTF_8, ISO_8859_1); for (Charset charsetTest : charsetsToBeTested) { CharsetDecoder decoder = charsetTest.newDecoder(); decoder.reset(); boolean identified = true; try (BufferedInputStream input = new BufferedInputStream(new FileInputStream(propsFile))) { byte[] buffer = new byte[512]; while (input.read(buffer) != -1 && identified) { try { decoder.decode(ByteBuffer.wrap(buffer)); identified = true; } catch (CharacterCodingException e) { identified = false; } } } if (identified) { return charsetTest; } } return null; } ConfigurationGenerator();  ConfigurationGenerator(boolean quiet, boolean debug); boolean isConfigurable(); void hideDeprecationWarnings(boolean hide); void setForceGeneration(boolean forceGeneration); boolean isForceGeneration(); CryptoProperties getUserConfig(); final ServerConfigurator getServerConfigurator(); void run(); boolean init(); boolean init(boolean forceReload); String changeTemplates(String newTemplates); void changeDBTemplate(String dbTemplate); void setDirectoryWithProperty(String key); String getUserTemplates(); File getNuxeoHome(); File getNuxeoBinDir(); @Deprecated(since = "11.1") File getNuxeoDefaultConf(); List<File> getIncludedTemplates(); void saveConfiguration(Map<String, String> changedParameters); void saveConfiguration(Map<String, String> changedParameters, boolean setGenerationOnceToFalse,
            boolean setGenerationFalseToOnce); void saveFilteredConfiguration(Map<String, String> changedParameters); Map<String, String> getChangedParameters(Map<String, String> changedParameters); String extractDatabaseTemplateName(); String extractSecondaryDatabaseTemplateName(); File getNuxeoConf(); void initLogs(); File getLogDir(); File getPidDir(); File getDataDir(); void verifyInstallation(); void checkJavaVersion(); static boolean checkJavaVersion(String version, String requiredVersion); void checkAddressesAndPorts(); InetAddress getBindAddress(); static InetAddress getBindAddress(String hostName); static void checkAddressReachable(InetAddress address); static void checkPortAvailable(InetAddress address, int port); File getTmpDir(); List<String> getLogFiles(); String rebuildTemplatesStr(String dbTemplate); File getConfigDir(); File getRuntimeHome(); boolean isInstallInProgress(); @Deprecated(since = "11.1") File getDistributionMPDir(); File getInstallFile(); void addTemplate(String templatesToAdd); List<String> getTemplateList(); void rmTemplate(String templatesToRm); String setProperty(String key, String value); Map<String, String> setProperties(Map<String, String> newParametersToSave); Map<String, String> setProperties(String template, Map<String, String> newParametersToSave); void checkDatabaseConnection(String databaseTemplate, String dbName, String dbUser, String dbPassword,
            String dbHost, String dbPort); Environment getEnv(); static Charset checkFileCharset(File propsFile); static Properties loadTrimmedProperties(File propsFile); static void loadTrimmedProperties(Properties props, InputStreamReader propsIS); File getDumpedConfig(); Hashtable<Object, Object> getContextEnv(String ldapUrl, String bindDn, String bindPassword,
            boolean checkAuthentication); void checkLdapConnection(String ldapUrl, String ldapBindDn, String ldapBindPwd, boolean authenticate); void checkLdapConnection(Hashtable<Object, Object> contextEnv); Crypto getCrypto(); @Deprecated(since = "11.1") File getTemplateConf(String template); File getTemplateDirectory(String template); List<String> getJavaOpts(Function<String, String> mapper); static final String NUXEO_ENVIRONMENT; static final String NUXEO_PROFILES; static final String TEMPLATE_SEPARATOR; static final String[] COMPLIANT_JAVA_VERSIONS; static final String NUXEO_CONF; static final String TEMPLATES; static final String NUXEO_DEFAULT_CONF; static final String NUXEO_ENVIRONMENT_CONF_FORMAT; static final String PARAM_TEMPLATES_NAME; static final String PARAM_TEMPLATE_DBNAME; static final String PARAM_TEMPLATE_DBSECONDARY_NAME; static final String PARAM_TEMPLATE_DBTYPE; static final String PARAM_TEMPLATE_DBSECONDARY_TYPE; static final String OLD_PARAM_TEMPLATES_PARSING_EXTENSIONS; static final String PARAM_TEMPLATES_PARSING_EXTENSIONS; static final String PARAM_TEMPLATES_FREEMARKER_EXTENSIONS; static final String PARAM_FORCE_GENERATION; static final String BOUNDARY_BEGIN; static final String BOUNDARY_END; static final List<String> DB_LIST; static final List<String> DB_SECONDARY_LIST; static final List<String> DB_EXCLUDE_CHECK_LIST; @Deprecated(since = "11.1")
    static final String PARAM_WIZARD_DONE; @Deprecated(since = "11.1")
    static final String PARAM_WIZARD_RESTART_PARAMS; static final String PARAM_FAKE_WINDOWS; static final String PARAM_LOOPBACK_URL; static final int MIN_PORT; static final int MAX_PORT; static final int ADDRESS_PING_TIMEOUT; static final String PARAM_BIND_ADDRESS; static final String PARAM_HTTP_PORT; @Deprecated
    static final String PARAM_STATUS_KEY; static final String PARAM_CONTEXT_PATH; @Deprecated(since = "11.1")
    static final String PARAM_MP_DIR; @Deprecated(since = "11.1")
    static final String DISTRIBUTION_MP_DIR; static final String INSTALL_AFTER_RESTART; static final String PARAM_DB_DRIVER; static final String PARAM_DB_JDBC_URL; static final String PARAM_DB_HOST; static final String PARAM_DB_PORT; static final String PARAM_DB_NAME; static final String PARAM_DB_USER; static final String PARAM_DB_PWD; @Deprecated(since = "11.1")
    static final String PARAM_MONGODB_NAME; @Deprecated(since = "11.1")
    static final String PARAM_MONGODB_SERVER; static final List<String> SECRET_KEYS; @Deprecated
    static final String PARAM_PRODUCT_NAME; @Deprecated
    static final String PARAM_PRODUCT_VERSION; static final String PARAM_NUXEO_URL; static final String NUXEO_DEV_SYSTEM_PROP; static final String SEAM_DEBUG_SYSTEM_PROP; static final String JVMCHECK_PROP; static final String JVMCHECK_FAIL; static final String JVMCHECK_NOFAIL; static final String JAVA_OPTS_PROP; static final String VERSIONED_REGEX; static final String BOOTSTRAP_JAR_REGEX; static final String JULI_JAR_REGEX; }