File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Which class is suitable ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Which class is suitable ?" Watch "Which class is suitable ?" New topic

Which class is suitable ?

benny rusli
Ranch Hand

Joined: Jan 15, 2005
Posts: 72
Hello people,

i have a question, which class is convenient to use for writing more than 15.000.000 rows in a text file. The following classes are considered :
FileReader and FileWriter from package, RandomAccessFile from package ,or FileChannel from java.nio package. For example i want to write the iterated number into a text file, as the below code shown :

Any help will be appreciated.
Mark Van Tuyl
Ranch Hand

Joined: Mar 22, 2002
Posts: 60
I would use something like this:

<a href="" target="_blank" rel="nofollow">How To Ask Smart Questions</a>
ak pillai
Ranch Hand

Joined: Feb 11, 2006
Posts: 288
Yes, as mark suggested use buffering for improved performance.

if you need real scalability (i.e. you want to use multi-threading etc) go with java.nio.*.
[ March 12, 2006: Message edited by: ak pillai ]

java j2ee job interview questions with answers | Learn the core concepts and the key areas
I agree. Here's the link:
subject: Which class is suitable ?
It's not a secret anymore!