private static File stream2file(InputStream in,String suffix) throws IOException {
  final File tempFile=File.createTempFile(PREFIX,suffix);
  try (FileOutputStream out=new FileOutputStream(tempFile)){
    IOUtils.copy(in,out);
  }
   return tempFile;
}

private static File stream2file ( InputStream in , String suffix ) throws IOException { final File tempFile = File . createTempFile ( PREFIX , suffix ) ; try ( FileOutputStream out = new FileOutputStream ( tempFile ) ) { IOUtils . copy ( in , out ) ; } return tempFile ; }
writes an inputstream to a temporary file .
