同上 分不够 我再加

解决方案 »

  1.   

    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();
    }
    最后直接转换成流 不要再转换成文件了 怎么搞?
      

  2.   

    可以参照下面代码: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));
    }
    }