mirror of
https://github.com/tiennm99/zfoo.git
synced 2026-10-12 16:15:42 +00:00
feat[util]: get file from class path to string
This commit is contained in:
1 parent
ddb241bb7f
commit
53a5866a30
1 file changed
+8
@@ -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