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 Swing / AWT / SWT and the fly likes Java Swing and Properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Java Swing and Properties file" Watch "Java Swing and Properties file" New topic
Author

Java Swing and Properties file

Aggarwal Arpit
Ranch Hand

Joined: Mar 04, 2012
Posts: 86

Can anybody explain what this code is doing?
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2409
Thanks for posting; does the post serve a particular purpose?
Aggarwal Arpit
Ranch Hand

Joined: Mar 04, 2012
Posts: 86
No.....I just want to get meaning of this code
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 20078
    
  30

Please UseCodeTags next time. It makes it easier to read your code.

It appears that this code replaces lines of a file that contain a specific sub string. Because modifying files on the fly is very tricky it uses an intermediate temporary file to write to first, which then overwrites the original file.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
Aggarwal Arpit
Ranch Hand

Joined: Mar 04, 2012
Posts: 86
Thanks for your help Rob,
Can you explain while loop once more?..........Why we are checking the indexOf(stringToCheck)?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> Why we are checking the indexOf(stringToCheck)?

did you read the apidocs for String to see what is returned?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java Swing and Properties file
 
jQuery in Action, 3rd edition