package com.product.file.util;
|
|
import com.product.core.exception.BaseException;
|
import com.product.file.config.FileCode;
|
|
import java.io.FileReader;
|
import java.io.IOException;
|
import java.util.Properties;
|
|
/**
|
* Copyright © 6c
|
*
|
* @Date: 2021-03-05 10:59
|
* @Author: 6c
|
* @Description:
|
*/
|
public class CommonUtil {
|
private CommonUtil() {}
|
|
/**
|
* 获取指定配置文件中的信息
|
* @return
|
*/
|
public static Properties getProperties() {
|
String path = System.getProperty("user.dir");
|
path = path + "/../../file/file.properties";
|
Properties properties = new Properties();
|
try (FileReader reader = new FileReader(path);) {
|
properties.load(reader);
|
return properties;
|
} catch (IOException e) {
|
throw new BaseException(FileCode.LOAD_FTP_PROPERTIES_FAIL.getValue(), FileCode.LOAD_FTP_PROPERTIES_FAIL.getText(), e);
|
}
|
}
|
}
|