Add a file to the FileSet.
<p>
If the file is a directory, it is turned into a JAR and the resulting JAR is added.
<p>
Files already added will be ignored.

@param file the file to be added.
191177
void add(final File file) {
    if (file.isFile()) {
      if (this.fileNames.contains(file.getName())) {
        LOG.log(Level.FINEST, "A file with this name has already been added: {0}", file.getName());
      } else {
        this.fileNames.add(file.getName());
        this.theFiles.add(file);
      }
    } else {
      LOG.log(Level.FINEST, "Ignoring, because it is not a proper file: {0}", file);
    }
  }
199856
private void addJarFileUrl(String jarFile)
    {
        if (jarUrls == null)
        {
            jarUrls = new HashSet<URL>();
        }
        try
        {
            jarUrls.add(new File(jarFile).toURI().toURL());
        }
        catch (MalformedURLException e)
        {
            log.error("Error while mapping jar-file url" + jarFile + "caused by:" + e.getMessage());
            throw new IllegalArgumentException("Invalid jar-file URL:" + jarFile + "Caused by: " + e);
        }
    }
1200693
public boolean addPath(File file) throws MalformedURLException {
        URL url = file.toURI().toURL();
        if ( !loadedPaths.contains( url ) ) {
            super.addURL( url );
            this.loadedPaths.add( url );
            return true;
        } else {
            return false;
        }
    }
871168
@Override
    public boolean accept(File file) {
        //All directories are added in the least that can be read by the Application
        if (file.isDirectory()&&file.canRead())
        {   return true;
        }
        else if(properties.selection_type==DialogConfigs.DIR_SELECT)
        {   /*  True for files, If the selection type is Directory type, ie.
             *  Only directory has to be selected from the list, then all files are
             *  ignored.
             */
            return false;
        }
        else
        {   /*  Check whether name of the file ends with the extension. Added if it
             *  does.
             */
            String name = file.getName().toLowerCase(Locale.getDefault());
            for (String ext : validExtensions) {
                if (name.endsWith(ext)) {
                    return true;
                }
            }
        }
        return false;
    }
1314514
@Override
    public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts) throws IOException, RDFParseException, RepositoryException {
        if(notNull(baseURI)) {
            getClient().sendAdd(file, baseURI, dataFormat, contexts);
        }else{
            getClient().sendAdd(file, file.toURI().toString(), dataFormat, contexts);
        }
    }
370771
public ClassFinder add(File file) {
    log.info("Adding file to look into: " + file.getAbsolutePath());

    if (fileCanContainClasses(file)) {
      String absPath = file.getAbsolutePath();
      if (placesToSearch.get(absPath) == null) {
        placesToSearch.put(absPath, file);
        for (AdditionalResourceLoader resourceLoader : resourceLoaders) {
          if (resourceLoader.canLoadAdditional(file)) resourceLoader.loadAdditional(file, this);
        }
      }
    } else {
      log.info("The given path '" + file.getAbsolutePath() + "' cannot contain classes!");
    }

    return this;
  }
1139433
void setFileTag(File file) throws IOException {
        if (initialized && fileEncodingCcsid != 0) {
            int returnCode = setFileTag(file.getAbsolutePath(), fileEncodingCcsid);
            if (returnCode != 0) {
                issueTaggingFailedMessage(returnCode);
            }
        }
    }
1292432
public void addFile(String path, InputStream inputStream) throws IOException {
    addFile(path, inputStream, null);
  }
1248019
@Override
    public void onFileCreate(File file) {
        try {
            engine.addTemplate(context.getBundle(0), file.toURI().toURL());
        } catch (MalformedURLException e) {
            LOGGER.error("Cannot compute the url of file {}", file.getAbsolutePath(), e);
        }
    }
269723
public void addPatternFromFile(String file) throws IOException {

		File f = new File(file);
		addPatternFromReader(new FileReader(f));
	}
704591
@Override
	public boolean accept(final File file) {
		if (file != null) {
			if (file.isDirectory()) {
				return true;
			}

			final String extension = getExtension(file);
			if (extension != null && filters.containsKey(extension)) {
				return true;
			}
		}
		return false;
	}
779666
public void setFile(File file) throws FileNotFoundException{
		this.setInputStream(new BufferedInputStream(new FileInputStream(file)), file.length());
		this.isUploadFile = true;
	}
922162
public T addFile(String file) {
    checkNotNull(file, "file");
    builder.files.add(file);
    return self();
  }
1318251
public static FileCreationState newFile(final File file) throws IOException
	{
		FileCreationState fileCreationState = FileCreationState.ALREADY_EXISTS;
		if (!file.exists())
		{
			fileCreationState = FileCreationState.FAILED;
			newParentDirectories(file);
			if (file.createNewFile())
			{
				fileCreationState = FileCreationState.CREATED;
			}
		}
		return fileCreationState;
	}
1069356
public void addAll(ClassLoaderFiles files) {
		Assert.notNull(files, "Files must not be null");
		for (SourceFolder folder : files.getSourceFolders()) {
			for (Map.Entry<String, ClassLoaderFile> entry : folder.getFilesEntrySet()) {
				addFile(folder.getName(), entry.getKey(), entry.getValue());
			}
		}
	}
156367
@Override
    public synchronized void onFileCreate(File file) {
        final Set<DetectedWebJar> listOfDetectedWebJarLib = isWebJar(file);
        if (listOfDetectedWebJarLib != null) {
            JarFile jar = null;
            try {
                jar = new JarFile(file);
                List<FileWebJarLib> installed = new ArrayList<>();
                for (DetectedWebJar detected : listOfDetectedWebJarLib) {
                    FileWebJarLib lib = expand(detected, jar);
                    if (lib != null) {
                        libs.add(lib);
                        installed.add(lib);
                        LOGGER.info("{} unpacked to {}", lib.name, lib.root.getAbsolutePath());
                    }
                }
                controller.addWebJarLibs(installed);
            } catch (IOException e) {
                LOGGER.error("Cannot open the jar file {}", file.getAbsolutePath(), e);
            } finally {
                IOUtils.closeQuietly(jar);
            }

        }
    }
151568
protected function addFile(File $file) {
        $files = $this->getFiles();
        $files[$file->getName()] = $file;
        $this->setFiles($files);
    }