title: How to create a new java.io.File in memory?
body: <p>How can I create new <code>File</code> (from <code>java.io</code>) in memory, not on the hard disk? </p>
  
  <p>I am using the Java language. I don't want to save the file on the hard drive.</p>
  
  <p>I'm faced with a bad API (<code>java.util.jar.JarFile</code>). It's expecting <code>File file</code> of <code>String filename</code>. I have no file (only <code>byte[]</code> content) and can create temporary file, but it's not beautiful solution. I need to validate the digest of a signed jar.</p>
  
  <pre><code>byte[] content = getContent();
  File tempFile = File.createTempFile("tmp", ".tmp");
  FileOutputStream fos = new FileOutputStream(tempFile);
  fos.write(archiveContent);
  JarFile jarFile = new JarFile(tempFile);
  Manifest manifest = jarFile.getManifest();
  </code></pre>
  
  <p>Any examples of how to achieve getting manifest without creating a temporary file would be appreciated.</p>