title: How to read a file in Groovy into a string, without knowing the path to the file?
body: <p>In extension to <a href="https://stackoverflow.com/questions/7729302/how-to-read-a-file-in-groovy-into-a-string">this question</a>. </p>
  
  <p>Is it possible to read a file into a string without knowing the path to the file? - I only have the file as a 'def'/type-less parameter, which is why I can't just do a .getAbsolutePath() </p>
  
  <p>To elaborate on this, this is how I import the file (which is from a temporary .jar file)</p>
  
  <pre><code>def getExportInfo(path) {
    def zipFile = new java.util.zip.ZipFile(new File(path))
  
    zipFile.entries().each { entry -&gt;
      def name = entry.name
      if (!entry.directory &amp;&amp; name == "ExportInfo") {
        return entry
      }
    }
  }
  </code></pre>