plzz help in transfer of data read from file

hi guys i have made a dialog box to select a file and m able to read contents from it

now i want to pass these contents to another function in the form of bytes

because i want to encrypt it

but i am not able 2 pass it

can someone help plzzztry

{

File f =new File(filename);

FileInputStream fis =new FileInputStream(f);

BufferedInputStream bis =new BufferedInputStream(fis);

BufferedReader dis =new BufferedReader(new InputStreamReader(bis));

while ( (record=dis.readLine()) !=null )

{

System.out.println(record);

}

this is how i am able to read the contents of file

now how i pass the contents of file to another function(in form of bytes preferably or string).

[1123 byte] By [noobs_will_rulea] at [2007-11-27 10:48:15]
# 1

You're already passing the contents to a method in the form of a String.

If you want bytes, look at String's docs for a method that turns a String into bytes.

jverda at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...
# 2

And next time I see you use words like "plzz", I will flat out refuse to ever help you again.

jverda at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...
# 3

sry but couldnt find the "passing the contents to a method in the form of a String."

where?

also i tried to get the print output of bis and dis

they come out like this:

bis: java.io.BufferedInputStream@b8f82d

dis: java.io.BufferedReader@1ad77a7

and jverd i'll make sure that i dont use words like "plzz" next time

Message was edited by:

noobs_will_rule

noobs_will_rulea at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...
# 4

So what does sry mean ?

Aknibbsa at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...
# 5

sry means i was sorry to jverd that i could not apply what solution he suggested

noobs_will_rulea at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...
# 6

BTW, your IO code is buffering -- twice! This is cleaner:

BufferedReader in= new BufferedReader(new FileReader(filename));

That's it!

BigDaddyLoveHandlesa at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...
# 7

but what i get is a input stream

how to get a string from it

or rather preferably in form of bytes

noobs_will_rulea at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...
# 8

Do you want to read from an InputStream or from a Reader? Asking for bytes from a reader defeats the purpose of using one, instead of using an input stream. What are your requirements?

BigDaddyLoveHandlesa at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...
# 9

"basically wat i intend to do is read from the file and encrypt the data

so programs that encrypt usually take data in form of bytes"

this is my sole purpose

so if anybody can suggest through his own logic ,what way to get data and pass it to the encryption function

noobs_will_rulea at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...
# 10

I think if you google, you will find examples.

BigDaddyLoveHandlesa at 2007-7-28 22:25:30 > top of Java-index,Java Essentials,New To Java...