title: How to read contents of a template file make changes and save as new file?
body: <p>I have a file lets call it template.cfg and I want to make changes to it and save the file with a new name preserving the template file.  </p>
  
  <p>Template file contents.  There is alot more in the file however these are the online lines i'm concerned about. </p>
  
  <pre><code>&lt;property&gt;URL&lt;/property&gt;
  &lt;property&gt;PASSWORD&lt;/property&gt;
  &lt;property&gt;SCHEMA&lt;/property&gt;
  &lt;property&gt;USER&lt;/property&gt;
  </code></pre>
  
  <p>Output file I want to have a new name lets call it databaseInfo.cfg  So i'd need to search for the words URL and replace it with a user defined URL same with PASSWORD SCHEMA and USER.  I would also like to save it in the same directory as the template.</p>
  
  <pre><code>&lt;property&gt;foo&lt;/property&gt;
  &lt;property&gt;bar&lt;/property&gt;
  &lt;property&gt;D2D&lt;/property&gt;
  &lt;property&gt;D2Duser&lt;/property&gt;
  </code></pre>
  
  <p>I'm thinking in terms like Save As.  not sure how I should go about modifying the file without changing the original and yet saving it as a new file. </p>
  
  <p>I dont have any code yet outside of getting the template files full path to open the file because I'm curious what is the best route to take from having the file.</p>
  
  <pre><code>File file = new File(template.cfg);
  String fullPath = file.getAbsolutePath();
  </code></pre>