关于绿盾解密功能java代码。
来源:互联网 发布:java 调用rs232串口 编辑:程序博客网 时间:2024/05/01 23:08
其实也就是个文件夹复制功能,解密前提需要绿盾支持该编程工具,在编程工具中运行该代码(其中原理自己去琢磨咯)。
<span style="font-size:14px;">package com.core;import java.io.File;import java.io.FileInputStream;import java.io.FileOutputStream;import java.io.InputStream;import java.text.DecimalFormat;/** * @Classname: Decrypt * @Description: TODO * @Author: chenn_xu@sina.cn * @Date: 2015年10月16日 上午11:04:32 * @Version:V1.0 */public class Decrypt {//待解密的文件夹路径private static String rootFolderPath = getFullpath("E:","decrypt_dev");//待解密文件夹路径中的文件夹private static String replace = "decrypt_new";//被替换的文件夹private static String beReplaced = "decrypt_dev";//解密文件数private static Integer fileCount = 0;//解密文件大小private static Long fileSize = new Long(0);public static void main(String[] args) {try {Long startTime = System.currentTimeMillis();decryptFolder(new File(rootFolderPath));System.out.println("------------------------------------------------------------------------------------------------");System.out.print("解密完成,共计耗时:"+new DecimalFormat("0.00").format((double)(System.currentTimeMillis()-startTime)/1000)+"s");System.out.print("\t共计文件:"+fileCount+"个");System.out.print("\t共计文件大小:"+new DecimalFormat(",##0.00").format((double)fileSize/1024/1024/1024)+"GB");System.out.print(" = "+new DecimalFormat(",##0.00").format((double)fileSize/1024/1024)+"mb");System.out.println(" = "+new DecimalFormat(",##0.00").format((double)fileSize/1024)+"kb");} catch (Exception e) {e.printStackTrace();}}/** * @Methodname: getFullpath * @Discription: TODO 拼接完整的路径 根据操作系统拼接连接符 * @param dir 路径 * @return */private static String getFullpath(String... dir){StringBuffer fullPath = new StringBuffer("");for (int i = 0; i < dir.length; i++) {fullPath.append(dir[i]);if (dir.length-1!=i) {fullPath.append(File.separator);}}return fullPath.toString();}/** * @Methodname: decryptFolder * @Discription: TODO 解密整个文件夹 * @param folder 文件夹 * @throws Exception */private static void decryptFolder(File folder)throws Exception {if (!folder.isDirectory()) {return;}File[] files = folder.listFiles();for (File file : files) {if (file.isFile()) {//进行解密操作decryptFile(file);fileCount ++;fileSize += file.length();continue ;}//创建文件夹File childFolder =new File(getFullpath(folder.getPath(),file.getName()));File newChilFolder =new File(childFolder.getPath().replaceFirst(beReplaced,replace));if (newChilFolder.exists()) {newChilFolder.delete();}newChilFolder.mkdir();//进行递归decryptFolder(childFolder);}}private static void decryptFile(File file){try { File newFile = new File(file.getPath().replaceFirst(beReplaced,replace)); if (newFile.exists()) { newFile.delete();} newFile.createNewFile(); FileOutputStream output = new FileOutputStream(newFile); InputStream input = new FileInputStream(file); int length = -1; byte[] _byte = new byte[8000];System.out.println(file.getPath());int sum = input.available();System.out.print("文件名:"+file.getPath());System.out.print("\t文件大小:"+new DecimalFormat("0.00").format((double)file.length()/1024)+"kb");System.out.print("\t已解密大小:"+new DecimalFormat("0.00").format((double)(file.length()-input.available())/1024)+"kb");System.out.println("\t已解密比例:"+(sum==0?"100%":new DecimalFormat("0.00%").format((double)(sum-input.available())/sum))+"kb"); while ((length=input.read(_byte))!=-1) { System.out.print("文件名:"+file.getPath());System.out.print("\t文件大小:"+new DecimalFormat("0.00").format((double)file.length()/1024)+"kb");System.out.print("\t已解密大小:"+new DecimalFormat("0.00").format((double)(file.length()-input.available())/1024)+"kb");System.out.println("\t已解密比例:"+(sum==0?"100%":new DecimalFormat("0.00%").format((double)(sum-input.available())/sum)));output.write(_byte, 0, length);} System.out.println(); input.close(); output.close();} catch (Exception e) {e.printStackTrace();} }}</span>
0 0
- 关于绿盾解密功能java代码。
- JAVA加密解密代码
- java代码--加密解密
- 关于代码加密解密保护
- 关于绿坝收费
- java内容加密解密代码!
- java AES 加解密代码
- 关于JAVA中RSA加签解签,私钥加密公钥解密和公钥加密私钥解密代码详解
- 关于JAVA中RSA加签解签,私钥加密公钥解密和公钥加密私钥解密代码步骤
- 关于JAVA解密的问题
- 关于网页代码加密、解密保护
- Java Base64加密、解密原理Java代码
- Java Base64加密、解密原理Java代码
- Java Base64加密、解密原理Java代码
- Java 功能代码
- java solr功能代码
- PGP透明加解密研究------代码结构与功能
- Delphi关于改进AES算法的加解密文件功能
- Android M USB流程
- Android笔记分享---Layout_weight的深刻理解
- spring 基于task机制调用(使用注解)
- Android数据适配器(Adapter)优化:使用高效的ViewHolder
- NEERC 2015 Southern Subregional G Hiring 树状数组
- 关于绿盾解密功能java代码。
- xpdf with vertical text
- K Nearest Neighbors - Classification
- xargs笔记
- 你不知道的JavaScript--Item20 作用域与作用域链(scope chain)
- nyistOJ-多边形重心问题(数学题)
- MySQL 调优
- ios深度解析之Swift(基本数据类型2)
- linux vim 常用命令 详解