设为首页 加入收藏

TOP

JAVA 在包里搜索所有的类(二)
2014-11-24 03:00:45 来源: 作者: 【 】 浏览:3
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脚本学习..

评论

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

·Sphinx : 高性能SQL (2025-12-24 10:18:11)
·Pandas 性能优化 - (2025-12-24 10:18:08)
·MySQL 索引 - 菜鸟教 (2025-12-24 10:18:06)
·Shell 基本运算符 - (2025-12-24 09:52:56)
·Shell 函数 | 菜鸟教 (2025-12-24 09:52:54)