CipherInputStream转换成FileInputStream 同上 分不够 我再加 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public void decrypt(String file, String dest) throws Exception { Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, this.key, zeroIv); InputStream is = new FileInputStream(file); OutputStream out = new FileOutputStream(dest); CipherOutputStream cos = new CipherOutputStream(out, cipher); byte[] buffer = new byte[1024]; int r; while ((r = is.read(buffer)) >= 0) { cos.write(buffer, 0, r); } cos.close(); out.close(); is.close(); }最后直接转换成流 不要再转换成文件了 怎么搞? 可以参照下面代码:public static void main(String[] args)throws Exception { CipherInputStream cis = new CipherInputStream(new FileInputStream("D:\\workspace\\study_pro\\src\\com\\study\\number\\NumberToCN.java"), new NullCipher()); byte[] buf = new byte[1024]; int i; while((i = cis.read(buf)) != -1){ System.out.println(new String(buf, 0, i)); } } 简单问题求教,谢谢!!! JSP如何引用class檔 关于增加数学知识提议 急救 这个错怎么去掉? 运行applet之后,ie中显示 "No Java 2 support for APPLET!! " 请问该怎么解决啊? java通过socket通讯发送excel文件到c#端,excel文件乱码 如何在jbuilder中使用mysql的jdbc驱动呢 启动JSDK服务器后,我如何让别人通过局域网访问我的HTML文件, super 问题 累加问题,求指点 ssh上安装jdk问题
cipher.init(Cipher.DECRYPT_MODE, this.key, zeroIv);
InputStream is = new FileInputStream(file);
OutputStream out = new FileOutputStream(dest);
CipherOutputStream cos = new CipherOutputStream(out, cipher);
byte[] buffer = new byte[1024];
int r;
while ((r = is.read(buffer)) >= 0) {
cos.write(buffer, 0, r);
}
cos.close();
out.close();
is.close();
}
最后直接转换成流 不要再转换成文件了 怎么搞?
CipherInputStream cis = new CipherInputStream(new FileInputStream("D:\\workspace\\study_pro\\src\\com\\study\\number\\NumberToCN.java"), new NullCipher());
byte[] buf = new byte[1024];
int i;
while((i = cis.read(buf)) != -1){
System.out.println(new String(buf, 0, i));
}
}