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 ...
随机推荐
- Linux通过使用pdb简单调试python计划
python自带的调试工具库:pdb # -*- coding:utf-8 -*- def func(num): s = num * 10 return s if __name__ == '__mai ...
- Java EE (9) -- JDBC & JTA
Connection接口中定义了5中隔离级别常量 Connection.TRANSACTION_NONE -- 不支持事务 Connection.TRANSACTION_READ_UNCOMMIT ...
- Linux下一个C(编程入门.h档,.c档,而路多文件的调用)
watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvdG90b3R1enVvcXVhbg==/font/5a6L5L2T/fontsize/400/fill/I0 ...
- 从零開始学android<RelativeLayout相对布局.十六.>
相对布局管理器指的是參考某一其它控件进行摆放,能够通过控制,将组件摆放在一个指定參考组件的上.下.左.右等位置,这些能够直接通过各个组件提供的属性完毕. 以下介绍一下各个方法的基本使用 No. 属性名 ...
- .net MVC AutoFac基地的环境建设
在Nuget在运行安装引用 Install-Package Autofac -Version 3.1.0 Install-Package Autofac.Mvc4 public static void ...
- LAMP一键安装包(Python版)
去年有出一个python整的LAMP自动安装,不过比较傻,直接调用的yum 去安装了XXX...不过这次一样有用shell..我也想如何不调用shell 来弄一个LAMP自动安装部署啥啥的..不过尼玛 ...
- JavaScript动漫作品(闭幕)
笔者:Steven Riche 发布时间:2014年2一个月18 原文链接:http://code.tutsplus.com/tutorials/javascript-animation-that-w ...
- Gradle构建多模块项目(转)
废话不多说,直接进入主题. 1. 创建项目 首先创建项目,名称为 test: mkdir test && cd test gradle init 这时候的项目结构如下: ➜ test ...
- cookie在vs又一次run的时候丢失
今天写个关于http cookie的demo,发现仅仅要vs又一次执行后cookie的值就会丢失,代码例如以下 protected void Page_Load(object sender, Even ...
- HDU-2857-Mirror and Light(计算几何)
Problem Description The light travels in a straight line and always goes in the minimal path between ...