title: Converting Java file:// URL to File(...) path, platform independent, including UNC paths
body: <p>I am developing a platform independent application. I am receiving a file URL*.
  On windows these are:</p>
  
  <ul>
  <li><p><code>file:///Z:/folder%20to%20file/file.txt</code></p></li>
  <li><p><code>file://host/folder%20to%20file/file.txt</code> (an UNC path)</p></li>
  </ul>
  
  <p>I am using <code>new File(URI(urlOfDocument).getPath())</code>which works fine with the first one and also on Unix, Linux, OS X, but does not work with UNC paths.</p>
  
  <p>What is the standard way to convert file: URLs to File(..) paths, being compatible with Java 6?</p>
  
  <p>......</p>
  
  <p>*
  Note: I am receiving theses URLs from OpenOffice / LibreOffice (XModel.getURL()).</p>