aspose file tools
The moose likes Beginning Java and the fly likes Content format in a text file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Content format in a text file" Watch "Content format in a text file" New topic
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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Content format in a text file
 
Similar Threads
can not deploy application!!!!
No JNDI name found in EJB
Need to understand about threading issues?
Help needed in executing the DTSRUN command in java code
550 Invalid recipient Problem whilst I am sending Email using SMTP