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!