0

私が書いたメソッドに到達できないようです。以下にメソッドを貼り付けます。

     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();
     }

次のように、クラスのインスタンスを使用してこのメ​​ソッドを呼び出そうとしています。 encryption.decrypt_data(new FileInputStream("C:/Users/Acer/Desktop/encrypted"),new FileOutputStream("C:/Users/Acer/Desktop/decrypted"));

Eclipseは私に教えてくれます:メソッドdecrypt_data(FileInputStream、FileOutputStream)は、タイプAES(つまりクラス名)に対して未定義です

ただし、次のメソッド呼び出しは完全に正常に機能します。

encryption.encrypt_data(new FileInputStream(fc.getSelectedFile().getPath()),new FileOutputStream("C:/Users/Acer/Desktop/encrypted"));

助けを待っています :D ありがとう。

4

2 に答える 2

2

スペルミスdecryt_datadecrypt_data.

あなたのメソッドは呼び出されpublic void decryt_data(InputStream in, OutputStream out)ました、にp欠落がありますdecryt

于 2013-03-19T03:16:50.960 に答える
0

decrypt_data() の代わりに decryt_data() を呼び出します

于 2013-03-19T03:17:45.497 に答える