Best File Saving Method ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shivan_Raptor
Posted On:   Wednesday, January 12, 2005 08:40 PM

I want to save a file with String and integers, which I need to encrypt it ,

but I don't know how to choose between (FileInputStream + FileOutputStream) and (FileReader + FileWriter) ?


in addition , when I save the file with any of the above methods, both returned a series of ASCII codes to me .

How can the encoding change to non-ASCII ?

Re: Best File Saving Method ?

Posted By:   Jani_Kaarela  
Posted On:   Thursday, January 13, 2005 12:29 AM


I want to save a file with String and integers, which I need to encrypt it ,
but I don't know how to choose between (FileInputStream + FileOutputStream) and (FileReader + FileWriter) ?


I'd say Reader/Writer is a natural choice, since it's character data.



in addition , when I save the file with any of the above methods, both returned a series of ASCII codes to me .
How can the encoding change to non-ASCII ?


The encoding issue suggests using Reader, too, but also brings up another issue:"The constructors of this class assume that the default character encoding and the default byte-buffer size are appropriate. To specify these values yourself, construct an InputStreamReader on a FileInputStream." (FileReader API). So, you'll need to follow the advise given in the API doc. Also, the InputStreamReader doc instructs to use buffering:" For top efficiency, consider wrapping an InputStreamReader within a BufferedReader.". See the API docs for details!

About | Sitemap | Contact