com.nepxion.discovery.common.util.IOUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of discovery-common Show documentation
Show all versions of discovery-common Show documentation
Nepxion Discovery is a solution for Spring Cloud with blue green, gray, weight, limitation, circuit breaker, degrade, isolation, monitor, tracing, dye, failover, async agent
package com.nepxion.discovery.common.util;
/**
* Title: Nepxion Discovery
* Description: Nepxion Discovery
* Copyright: Copyright (c) 2017-2050
* Company: Nepxion
* @author Haojun Ren
* @version 1.0
*/
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class IOUtil {
public static InputStream getInputStream(String path) throws IOException {
// 从Resource路径获取
InputStream inputStream = IOUtil.class.getClassLoader().getResourceAsStream(path);
if (inputStream == null) {
// 从文件路径获取
inputStream = new FileInputStream(path);
}
return inputStream;
}
}