title: How to convert a String into a File Object in java?
body: <p>I have file contents in a java string variable, which I want to convert it into a <code>File</code> object is that possible?</p>
  
  <pre><code>public void setCfgfile(File cfgfile)
  {
      this.cfgfile = cfgfile
  }
  
  public void setCfgfile(String cfgfile)
  {
      println "ok overloaded function"
      this.cfgfile = new File(getStreamFromString(cfgfile))
  }
  private def getStreamFromString(String str)
  {
      // convert String into InputStream
      InputStream is = new ByteArrayInputStream(str.getBytes())
      is
  }
  </code></pre>