code: public static String getUriWithOutputDir(DocumentURI key, String outputDir){
          String uri = key.getUri();
          if (outputDir != null && !outputDir.isEmpty()) {
              uri = outputDir.endsWith("/") || uri.startsWith("/") ? 
                    outputDir + uri : outputDir + '/' + uri;
              key.setUri(uri);
              key.validate();
          }    
          return uri;
      }
docs: If outputDir is available and valid, modify DocumentURI, and return uri
  in string
  
  @param key
  @param outputDir
  @return URI