private boolean writeJarBytesToFile(final File file,final byte[] jarBytes){
  final boolean isDebugEnabled=logger.isDebugEnabled();
  try {
    if (file.createNewFile()) {
      if (isDebugEnabled) {
        logger.debug("Successfully created new JAR file: {}",file.getAbsolutePath());
      }
      final OutputStream outStream=new FileOutputStream(file);
      outStream.write(jarBytes);
      outStream.close();
      return true;
    }
    return doesFileMatchBytes(file,jarBytes);
  }
 catch (  IOException ioex) {
    if (isDebugEnabled) {
      logger.debug("IOException while trying to write JAR content to file: {}",ioex);
    }
    return false;
  }
}

private boolean writeJarBytesToFile ( final File file , final byte [ ] jarBytes ) { final boolean isDebugEnabled = logger . isDebugEnabled ( ) ; try { if ( file . createNewFile ( ) ) { if ( isDebugEnabled ) { logger . debug ( "Successfully created new JAR file: {}" , file . getAbsolutePath ( ) ) ; } final OutputStream outStream = new FileOutputStream ( file ) ; outStream . write ( jarBytes ) ; outStream . close ( ) ; return true ; } return doesFileMatchBytes ( file , jarBytes ) ; } catch ( IOException ioex ) { if ( isDebugEnabled ) { logger . debug ( "IOException while trying to write JAR content to file: {}" , ioex ) ; } return false ; } }
attempt to write the given bytes to the given file . if this vm is able to successfully write the contents to the file , or another vm writes the exact same contents , then the write is considered to be successful .
