public static File createTempFile ( byte [ ] fileContents , String namePrefix , String extension ) throws IOException { Preconditions . checkNotNull ( fileContents , "file contents missing" ) ; File tempFile = File . createTempFile ( namePrefix , extension ) ; try ( FileOutputStream fos = new FileOutputStream ( tempFile ) ) { fos . write ( fileContents ) ; } return tempFile ; }
Stores the given contents into a temporary file