private static void writeFile ( final HttpQuery query , final String path , final byte [ ] contents ) { try { final FileOutputStream out = new FileOutputStream ( path ) ; try { out . write ( contents ) ; } finally { out . close ( ) ; } } catch ( FileNotFoundException e ) { logError ( query , "Failed to create file " + path , e ) ; } catch ( IOException e ) { logError ( query , "Failed to write file " + path , e ) ; } }
Writes the given byte array into a file . This function logs an error but doesn t throw if it fails .