Hi all,
i am doing encryption by using fileinput and fileoutputstreams, i am
able to encrypt one file and write the encrypted contents to second
file.
but now i want to change it, encryption will be done on a single file
no second file will be created.
so i changed the FileInputStream and FileOutputStream pointing to the
same file but in this my encryption works fine but when i am clicking
on button to encrypt then My file will get empty.

can someone please check the code if something is missing:
Encryption part:-----

in = new FileInputStream("/mnt/sdcard/abc.txt");
                                    fout = new 
FileOutputStream("/mnt/sdcard/abc.txt");
                                    out = new CipherOutputStream(fout,cipher);

                                    int num = 0;
                                    buffer = new byte[1024];
                                        while((num = in.read(buffer)) >=0)
                                        {
                                                out.write(buffer, 0, num);

                                        }

                                        in.close();
                                        out.close();
                                        fout.close();

encSuccess.setText("File Encrypted Successfully");

Input and Outputstreams are same beacause i have to write the
encrypted contents to the same file.
Please correct my code if i am doing something wrong.

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to