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 ...
随机推荐
- 《Javascript高级程序设计》读书笔记之闭包
闭包 function createComparisonFunction(propertyName) { return function (object1, object2) { var value1 ...
- Java EE (5) -- Java EE 6 JavaServer Faces Developer Certified Expert(1z0-896)
Section 1: Essentials of JSF2.0 Identify the features of JSF such as Facelets, BookMarkable View, AJ ...
- 採用Android中的httpclient框架发送post请求
/** * 採用httpclientPost请求的方式 * * @param username * @param password * @return null表示求得的路径有问题,text返回请求得 ...
- 设计模式 - 模板方法模式(template method pattern) JFrame 具体解释
模板方法模式(template method pattern) JFrame 具体解释 本文地址: http://blog.csdn.net/caroline_wendy 參考模板方法模式(templ ...
- Red Gate系列之二 SQL Source Control 3.0.13.4214 Edition 数据库版本控制器 完全破解+使用教程
原文:Red Gate系列之二 SQL Source Control 3.0.13.4214 Edition 数据库版本控制器 完全破解+使用教程 Red Gate系列之二 SQL Source Co ...
- 很久没来这里,今天的评测java怪东西,左右Date类和时间戳转换
在发展过程中,经常会遇到利用上课时间.说话的Date类就不得不提时间戳,左右fr=aladdin" target="_blank">的定义大家能够看看网上对时间戳的 ...
- centos6.4设备hadoop-2.5.1(完全分布式)
环境介绍: 在这两种装备centos6.4(32位置)的server安装Hadoop-2.5.1分布式集群(2台机器,主要试验用.哈哈). 1.改动主机名和/etc/hosts文件 1)改动主机名(非 ...
- 【NO.3】 c program to caculate and display sum of two matrix
source code: #include "stdafx.h" /* display sum of two matrix*/ int _tmain(int argc, _TCHA ...
- [原创] 使用rpi + crontab + git 定时向bitbucket 推送 照片
#前提条件,你得有一个bitbucket的帐户 1.定时启动脚本代码 使用的是crontab Cronfile 内容如下: 此文件的意思是,每隔10分钟,就运行一次 /home/pi/Rpi_uplo ...
- Swift新手教程3-字符串String
原创blog,转载请注明出处 String 在swfit中,String兼容Unicode的方式.用法和C语言类似. 注意 在Cocoa和Cocoa touch中,Swift的String,和Fo ...