Saturday, June 13, 2015

Write a File using Java NIO

The following example shows how to write a file using Java NIO. It creates a file named loginlist.txt, if the file already exists then it will remove it. The following code also generate random strings of arbitrary length. The strings are written in the following format :-

<Random Strings> : <Random Strings>

It writes 10 million entries and takes 32 seconds in my PC (Intel Core i3 2nd Gen, RAM - 4 GB) to complete and file size reaches to about 180 MB.

0 comments :

Post a Comment

Follow Me!

Blog Archive

Followers

Visitor Map