1.文件在服务器上面,根据www.xxx等去取的
int size;
// 路径
URL url = new URL(log_path);
// 去文件
URLConnection conn = url.openConnection();
// 得到文件大小
size = conn.getContentLength();
// 得到文件流
InputStream in = conn.getInputStream();
// 文件加密
String fileMD5 = DigestUtils.md5Hex(in);
2
// 路径
String log_path = AppUtils.getWebRootPath() + data.get("curVerUrl");
// 文件路径加密
String fileMD5 = DigestUtils.md5Hex(new FileInputStream(log_path));
File file = new File(log_path);
// 文件大小
System.out.println("文件加密后:"+fileMD5+",大小为:"+file.length());
data.put("fileSize", file.length()+"");
data.put("fileMD5", fileMD5);