title: How to convert a filepath to valid file path in Java 1.7
body: <p>Using Java 1.6 Filepath can be entered by user and then I apply various regular expressions to remove characters that are invalid for the platform (such as '?' is invalid on Windows), and check path length to ensure we end up with a valid filepath for the OS before trying to create the filepath.</p>
  
  <p>But there are two problems:</p>
  
  <ol>
  <li>Its a pain working out what is valid or not for each platform.</li>
  <li>I'm making assumptions based on default filesystem for the platform, but of course an OSX system could be writing to a non-mac filesystem such a FAT32, in which case these checks will not be valid.</li>
  </ol>
  
  <p>So I was hoping there would be a better way to do it with NIO2 in Java 7, but haven't found a solution yet, is there one ?</p>