/
NeonBite
/
sockets
Обзор
Документация
Войти
/
NeonBite
/
sockets
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/main/java/org/example/ConfigReader.java
43 строки
1 KB
Winnie-the-Pooh2019
initial commit
01 дек 2025, 04:11
01 дек 2025, 04:11
4d20599
Код
Авторство
О чём код?
package org.example; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class ConfigReader { private final String host; private final int port; private static ConfigReader reader; private ConfigReader() { Properties properties = new Properties(); InputStream input = this.getClass() .getClassLoader() .getResourceAsStream("application.properties"); try { properties.load(input); host = properties.getProperty("server.host"); port = Integer.parseInt(properties.getProperty("server.port")); } catch (IOException e) { throw new RuntimeException(e); } } public String getHost() { return host; } public int getPort() { return port; } public static ConfigReader getInstance() { if (reader == null) reader = new ConfigReader(); return reader; } }