设为首页 加入收藏

TOP

JAVA 在包里搜索所有的类(二)
2014-11-24 03:00:45 来源: 作者: 【 】 浏览:5
Tags:JAVA 包里 搜索 有的
th);
for (File file : dir.listFiles()) {
if (file.isFile()) {
String clsName = file.getName();
clsName = pkgName + "."
+ clsName.substring(0, clsName.length() - 6);
ret.add(clsName);
}
}
} else {
FileInputStream fis = new FileInputStream(classPath);
JarInputStream jis = new JarInputStream(fis, false);
JarEntry e = null;
while ((e = jis.getNextJarEntry()) != null) {
String eName = e.getName();
if (eName.startsWith(rPath) && !eName.endsWith("/")) {
ret.add(eName.replace('/', '.').substring(0,
eName.length() - 6));
}
jis.closeEntry();
}
jis.close();
}
} catch (Exception e) {
throw new RuntimeException(e);
}


return ret;
}
}


ok = .:. =


首页 上一页 1 2 下一页 尾页 2/2/2
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Python和Java不同的地方 下一篇Ubuntu Linux Bash Shell脚本学习..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·python数据分析岗的 (2025-12-25 10:02:21)
·python做数据分析需 (2025-12-25 10:02:19)
·成为一个优秀的pytho (2025-12-25 10:02:16)
·Java后端面试实习自 (2025-12-25 09:24:21)
·Java LTS版本有哪些 (2025-12-25 09:24:18)