protected void moveToFinalFile(Path tempOutFilePath,Path destination) throws IOException {
  Path src=Path.getPathWithoutSchemeAndAuthority(tempOutFilePath);
  Path dst=Path.getPathWithoutSchemeAndAuthority(destination);
  boolean moveSuccessful=false;
  if (!outputFS.exists(dst.getParent())) {
    outputFS.mkdirs(dst.getParent());
  }
  if (outputFS.exists(dst)) {
    outputFS.delete(dst,false);
  }
  moveSuccessful=outputFS.rename(src,dst);
  if (moveSuccessful) {
    LOG.debug("File {} moved successfully to destination folder.",dst);
  }
 else {
    throw new RuntimeException("Unable to move file from " + src + " to "+ dst);
  }
}

protected void moveToFinalFile ( Path tempOutFilePath , Path destination ) throws IOException { Path src = Path . getPathWithoutSchemeAndAuthority ( tempOutFilePath ) ; Path dst = Path . getPathWithoutSchemeAndAuthority ( destination ) ; boolean moveSuccessful = false ; if ( ! outputFS . exists ( dst . getParent ( ) ) ) { outputFS . mkdirs ( dst . getParent ( ) ) ; } if ( outputFS . exists ( dst ) ) { outputFS . delete ( dst , false ) ; } moveSuccessful = outputFS . rename ( src , dst ) ; if ( moveSuccessful ) { LOG . debug ( "File {} moved successfully to destination folder." , dst ) ; } else { throw new RuntimeException ( "Unable to move file from " + src + " to " + dst ) ; } }
moving temp output file to final file
