Code digest
private void travelDir(String filepath) {
String threadName = Thread.currentThread().toString();
logger.info("TargetDir:" + threadName + "==>" + filepath);
File dir = new File(filepath);
logger.info("dir.exists():" + threadName + "==>" + dir.exists()); if (dir.exists()) {
logger.info("dir.isDirectory():" + threadName + "==>"
+ dir.isDirectory());
File[] files = dir.listFiles();
for (File file : files) {
logger.info("file.getAbsolutePath():" + threadName + "==>"
+ file.getAbsolutePath());
}
}
}
public class CalcutateTest {
@Test
public void testAdd() {
Calcutate cal = new Calcutate();
Class<Calcutate> c = Calcutate.class;// 获得class类 try {
Method method = c.getDeclaredMethod("add", new Class[] { int.class,
int.class });// 获得method.注意,这里不能使用getMethod方法,因为这个方法只能获取public修饰的方法..
method.setAccessible(true);// 这个设置为true.可以无视java的封装..不设置这个也无法获取这个Method
Object result = method.invoke(cal, new Object[] { 2, 10 });
Assert.assertEquals("Must equals.",12, result);// 这里自动拆箱..
} catch (Exception e) {
e.printStackTrace();
} }
}
Code digest的更多相关文章
- nginx HttpLuaModule
http://wiki.nginx.org/HttpLuaModule#Directives Name ngx_lua - Embed the power of Lua into Nginx This ...
- ruby md5 sha1 base64加密
#md5加密 require 'md5' puts MD5.hexdigest('admin') #sha1加密 require 'digest/sha1' puts Digest::SHA1.hex ...
- IPFS - 可快速索引的版本化的点对点文件系统(草稿3)
摘要 星际文件系统是一种点对点的分布式文件系统, 旨在连接所有有相同的文件系统的计算机设备.在某些方面, IPFS类似于web, 但web 是中心化的,而IPFS是一个单一的Bittorrent 群集 ...
- Tomcat的安全性
Web应用程序的一些内容是受限的,只有授权的用户在提供了正确的用户名和密码后才能查看他们,servlet技术支持通过配置部署 描述器(web.xml)来对这些内容进行访问控制,那么web容器是怎么样支 ...
- Nginx+lua+openresty精简系列
1. CentOS系统安装openresty 你可以在你的 CentOS 系统中添加 openresty 仓库,这样就可以便于未来安装或更新我们的软件包(通过 yum update 命令).运行下面的 ...
- Atitit HTTP 认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结
Atitit HTTP认证机制基本验证 (Basic Authentication) 和摘要验证 (Digest Authentication)attilax总结 1.1. 最广泛使用的是基本验证 ( ...
- 【java】之 apache commons-codec 与Apache Digest demo实例,支持md5 sha1 base64 hmac urlencode
使用commons-codec 进行加密的一些操作 package com.jiepu.ApacheDigest; import java.io.FileInputStream; import org ...
- [转载]iOS Provisioning Profile(Certificate)与Code Signing详解
原文:http://blog.csdn.net/phunxm/article/details/42685597 引言 关于开发证书配置(Certificates & Identifiers & ...
- iOS Provisioning Profile(Certificate)与Code Signing详解
引言 关于开发证书配置(Certificates & Identifiers & Provisioning Profiles),相信做 iOS 开发的同学没少被折腾.对于一个 iOS ...
随机推荐
- git笔记之解决eclipse不能提交jar等文件的问题
今天用git托管了一个java web项目,由于是web项目,所以要上传jar文件(此项目未使用maven管理),一直使用git commit and push,就是在server上看不到jar文件上 ...
- C++出现计算机术语5
class template(类模板) 可以用来定义一个类定义了一组特定类型的类的.类模板template keyword其次是尖括号(<>)附上.的列表来定义. export keywo ...
- 使用Xamarin在Visual Studio中开发Android应用
原文:使用Xamarin在Visual Studio中开发Android应用 本文使用的环境是Windows 8 Visual Studio 2012.2 1.下载Xamarin http://xam ...
- update和saveOrUpdate具体解释
在Hibernate中,最核心的概念就是对PO的状态管理.一个PO有三种状态: 1.未被持久化的VO 此时就是一个内存对象VO,由JVM管理生命周期 2.已被持久化的PO,而且在Session生 ...
- Moran’s I空间统计中出现内存溢出的问题
在经济学.资源管理.生物地理学.政治地理学和人口统计等领域,经常会有如下的研究需求: 研究区域中的富裕区和贫困区之间的最清晰边界在哪里? 研究区域中存在可以找到异常消费模式的位置吗? 研究区域中意想不 ...
- Ubuntu下用NdisWrapper安装网卡驱动
下面是一个简单全面的使用NdisWrapper的指南.这是从Beginning Ubuntu Linux, Second Edition中提炼出来的. 这份指南是第8章的一部分.该章给出了在Ubunt ...
- 读懂IL
读懂IL 先说说学IL有什么用,有人可能觉得这玩意平常写代码又用不上,学了有个卵用.到底有没有卵用呢,暂且也不说什么学了可以看看一些语法糖的实现,或对.net理解更深一点这些虚头巴脑的东西.最重要的理 ...
- 【原创】leetCodeOj --- Dungeon Game 解题报告
原题地址: https://oj.leetcode.com/problems/dungeon-game/ 题目内容: The demons had captured the princess (P) ...
- linux下"="号与"=="号
<鸟哥的linux私房菜>基础学习篇P382中说,在bash中"="与"=="是同样的,都代表推断是否相等,仅仅只是因为其它语言一般写法使用&quo ...
- ios-上拉电阻负载许多其他接口
想尝试拉加载意识到有多少开始了他的研究之旅,我看了两天做出最终的界面. 之所以这么慢是由于,我不知道要将上拉出现的view放在哪.就能在scrollView拉究竟部的时候被拉出来.还有就是怎么拉出来之 ...