| Author |
Content format in a text file
|
vinodh kumar
Ranch Hand
Joined: Jan 07, 2008
Posts: 41
|
|
Hi,
Can some one advice how to approach in java to format the content of a file as mentioned below.
Present:
Output:
|
VINODH KUMAR
/**SCJP 1.5***chemical engineering rocks*/ [My Wiki]
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19232
|
|
Do you know how to read lines of a file? Do you know how to write lines to a file?
The basic algorithm is this:
1) read ====
2) if there are no more lines available abort
3) read 4 lines
4) combine those 4 lines into one line
5) write that line
6) go to step 1
If you use a Scanner the reading and checking can be done using nextLine() and hasNextLine().
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
vinodh kumar
Ranch Hand
Joined: Jan 07, 2008
Posts: 41
|
|
Thanks Rob.
Let me try based on your algorithm and will revert if any problem.
~Vinodh Kumar
|
 |
 |
|
|
subject: Content format in a text file
|
|
|