This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes deletion of space between two lines Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "deletion of space between two lines" Watch "deletion of space between two lines" New topic
Author

deletion of space between two lines

nandireddy sreekanthreddy
Greenhorn

Joined: Jun 26, 2001
Posts: 8
i have a text file in that how can i delete the space between two lines using io package . what i mean is, i have three lines gap between the lines . i want to remove that space between that lines
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
hi,
you can read the file line by line and write everithing but the empty lines to a second file. or you can read all to a Vector (all but the empty lines) and when done, you write the contents of the vector back to the same file.
you can read the file by creating a BufferedReader Object.
you can write the file by creating a PrintWriter Object.
(or other from the io familly, depends in the input/output you want and need)
pascal
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: deletion of space between two lines
 
It's not a secret anymore!