passing data from a file between methods

hi guys,

i have an encrypt method that reads in the data and encrypts it. withn the method. i need to change it so that there is a User input method and an encyrpt method. what i was wondering is how i stream the input file data from the user input method to the encrypt method.

the user enters the file to read.

// user inputs the file to encrypt

System.out.println("please select the file to encrypt");

BufferedReader fileInput =new BufferedReader(new InputStreamReader(System.in));

String encFileToRead =null;

encFileToRead = fileInput.readLine();

the file is used by file input stream

FileImageInputStream fileInputStream =new FileImageInputStream(new File(encFileToRead));

byte[] buffer =newbyte[1024];

int numberBytesRead = 0;

while ((numberBytesRead = fileInputStream.read(buffer)) != -1){

encryptedCipherOutputStream.write(buffer, 0, numberBytesRead);

}

encryptedCipherOutputStream.close();

thanks in advance

[1465 byte] By [c4rtera] at [2007-11-27 1:49:03]
# 1

Presumably you mean that you need to display the un-encrypted content (all or part) to a user for modification before doing something with it.

So

1. Unencrypt it into a String (or some other structure as appropriate.)

2. Display that to the user.

3. Collect the result from the user.

4. Pass the result to the final method.

jschella at 2007-7-12 1:13:51 > top of Java-index,Java Essentials,Java Programming...
# 2
im affraid not! what i need to do is read the file into the user input method and then pass the contents of the file to the encrypt method, but im not sure how to do that using the input stream!
c4rtera at 2007-7-12 1:13:51 > top of Java-index,Java Essentials,Java Programming...