对于类型Class_name,方法method_name(FileInputStream,FileOutputStream)未定义

时间:2013-03-19 03:14:14

标签: java encryption cryptography blowfish

我写的方法似乎无法访问。我正在粘贴下面的方法:

     public void decryt_data(InputStream in, OutputStream out) throws   InvalidKeyException,  IOException {
         // initialize the cipher
          cipher.init(Cipher.DECRYPT_MODE, secret_key);      
          // Bytes read from in will be decrypted
            in = new CipherInputStream(in, cipher);             
            int numRead = 0;
            while ((numRead = in.read(buf)) >= 0)
            {
                out.write(buf, 0, numRead);
            }
            out.close();
     }

public void decryt_data(InputStream in, OutputStream out) throws InvalidKeyException, IOException { // initialize the cipher cipher.init(Cipher.DECRYPT_MODE, secret_key); // Bytes read from in will be decrypted in = new CipherInputStream(in, cipher); int numRead = 0; while ((numRead = in.read(buf)) >= 0) { out.write(buf, 0, numRead); } out.close(); }

我正在尝试使用Class的实例调用此方法,如下所示:

Eclipse告诉我:方法decrypt_data(FileInputStream,FileOutputStream)未定义为AES类型(即类名)

然而,以下方法调用完全正常:

encryption.decrypt_data(new FileInputStream("C:/Users/Acer/Desktop/encrypted"),new FileOutputStream("C:/Users/Acer/Desktop/decrypted"));

等待一些帮助:D谢谢。

2 个答案:

答案 0 :(得分:2)

拼写错误decryt_data应为decrypt_data

您的方法被称为public void decryt_data(InputStream in, OutputStream out)p

中缺少decryt

答案 1 :(得分:0)

调用decryt_data()而不是decrypt_data()