mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-08-18 08:25:32 +00:00
feat[util]: get file from class path to string
This commit is contained in:
@@ -40,6 +40,14 @@ public abstract class ClassUtils {
|
||||
return getDefaultClassLoader().getResource(filePath).openStream();
|
||||
}
|
||||
|
||||
public static String getFileFromClassPathToString(String filePath) {
|
||||
try {
|
||||
return StringUtils.bytesToString(IOUtils.toByteArray(ClassUtils.getFileFromClassPath(filePath)));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取编译过后的类文件(*.class)的绝对路径
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user