Add file to CLASSPATH
@param s File name
@throws IOException  IOException
194160
public static void addFile(String s) throws IOException {
        File f = new File(s);
        addFile(f);
    }
664506
public void addJarFile(String jarFile)
    {
        if (jarFiles == null)
        {
            jarFiles = new HashSet<String>();
        }
        this.jarFiles.add(jarFile);
        addJarFileUrl(jarFile);

    }
1184003
private static void addHiveSiteDirToClasspath(String hiveSiteDir) {
    LOG.info("Adding " + hiveSiteDir + " to CLASSPATH");
    File f = new File(hiveSiteDir);
    try {
      URL u = f.toURI().toURL();
      URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
      Class<URLClassLoader> urlClass = URLClassLoader.class;
      Method method = urlClass.getDeclaredMethod("addURL", new Class[] { URL.class });
      method.setAccessible(true);
      method.invoke(urlClassLoader, new Object[] { u });
    } catch (ReflectiveOperationException | IOException e) {
      throw new RuntimeException("Unable to add hive.site.dir to CLASSPATH", e);
    }
  }
780461
public void loadClassPath() throws IOException
    {
        Class<?> dClass    = this.getClass();
        CodeSource codeSrc = this.getClass().getProtectionDomain().getCodeSource();
        if ( codeSrc == null ) {
            return;
        }
        
        String codePath = codeSrc.getLocation().getPath();
        if ( codePath.toLowerCase().endsWith(".jar") ) {
            ZipInputStream zip = new ZipInputStream(codeSrc.getLocation().openStream());
            while ( true ) {
                ZipEntry e = zip.getNextEntry();
                if ( e == null ) {
                    break;
                }
                
                String fileName = e.getName();
                if ( fileName.endsWith(".lex") 
                        && fileName.startsWith("lexicon/lex-") ) {
                    load(dClass.getResourceAsStream("/"+fileName));
                }
            }
        } else {
            //now, the classpath is an IDE directory 
            //  like eclipse ./bin or maven ./target/classes/
            loadDirectory(codePath+"/lexicon");
        }
    }
1371259
public ClassFinder addClasspath() {
    try {
      String path = System.getProperty("java.class.path");
      StringTokenizer tok = new StringTokenizer(path, File.pathSeparator);
      while (tok.hasMoreTokens())
        add(new File(tok.nextToken()));
    } catch (Exception ex) {
      log.error("Unable to get class path", ex);
    }
    return this;
  }
110362
public Jar addEntry(Path path, String file) throws IOException {
        return addEntry(path, Paths.get(file));
    }
1140696
public Jar addEntry(Path path, Path file) throws IOException {
        return addEntry(path, Files.newInputStream(file));
    }
1338471
public void addHeader(String s) throws IOException
    {
        Integer h=(Integer)__headerMap.get(s);
        if (h!=null)
            addInt(h.intValue());
        else
            addString(s);
    }
668858
private static void addFileToZip(String path, File file, ZipOutputStream zos) throws IOException {
        String currentPath = StringUtils.isNotEmpty(path)? path + "/" + file.getName(): file.getName();

        zos.putNextEntry(new ZipEntry(currentPath));

        InputStream is = new BufferedInputStream(new FileInputStream(file));
        try {
            IOUtils.copy(is, zos);
        } finally {
            IOUtils.closeQuietly(is);
        }

        zos.closeEntry();
    }
394257
public void setFilePath(String filePath)
    {
        //create a new file
        File fileInstance=null;
        if(filePath!=null)
        {
            fileInstance=new File(filePath);
        }
        
        //set file
        this.setFile(fileInstance);
    }
727319
@SuppressWarnings("checkstyle:nestedifdepth")
	public static void addToSystemClasspath(String entries) {
		if (!Strings.isNullOrEmpty(entries)) {
			final List<URL> cp = new ArrayList<>();
			final String[] individualEntries = entries.split(Pattern.quote(File.pathSeparator));
			for (final String entry : individualEntries) {
				if (!Strings.isNullOrEmpty(entry)) {
					URL url = FileSystem.convertStringToURL(entry, false);
					if (url != null) {
						// Normalize the folder name in order to have a "/" at the end of the name.
						// Without this "/" the class loader cannot find the resources.
						if (URISchemeType.FILE.isURL(url)) {
							final File file = FileSystem.convertURLToFile(url);
							if (file != null && file.isDirectory()) {
								try {
									url = new URL(URISchemeType.FILE.name(), "", file.getAbsolutePath() + "/"); //$NON-NLS-1$//$NON-NLS-2$
								} catch (MalformedURLException e) {
									//
								}
							}
						}
						cp.add(url);
					}
				}
			}
			final URL[] newcp = new URL[cp.size()];
			cp.toArray(newcp);
			synchronized (Boot.class) {
				dynamicClassLoader = URLClassLoader.newInstance(newcp, ClassLoader.getSystemClassLoader());
			}
		}
	}
587389
public void setClasspath(Path classpath) {
        if (taskClasspath == null) {
            taskClasspath = classpath;
        }
        else {
            taskClasspath.append(classpath);
        }
    }
925339
@Override
    public synchronized void addFile(File pFile, String pRelativePath) throws TTException, IOException {
        // LOGGER.info("Adding file " + pFile.getName());

        int readingAmount = 0;

        @SuppressWarnings("resource")
        FileChannel ch = new RandomAccessFile(pFile, "rw").getChannel();
        FileLock lock = null;

        while (lock == null) {
            try {
                lock = ch.tryLock();
            } catch (OverlappingFileLockException e) {
                // File is already locked in this thread or virtual machine
            }
        }

        // LOGGER.info("Filesize: " + ch.size());

        ByteBuffer buffer = ByteBuffer.allocate(FileData.FILENODESIZE);

        // LOGGER.debug("Successfully initialized byte source.");
        readingAmount += ch.read(buffer);

        // LOGGER.debug("First readAmount: " + readingAmount);
        if (readingAmount <= 0) {
            MetaKey key = new MetaKey(pRelativePath);
            MetaValue value = new MetaValue(FilelistenerReadTrx.emptyFileKey);
            getBucketTransaction().getMetaBucket().put(key, value);

            return;
        }

        long newKey = getBucketTransaction().incrementDataKey();

        if (fileExists(pRelativePath)) {
            removeFile(pRelativePath);
        }

        // Setting a new header file data
        MetaKey key = new MetaKey(pRelativePath);
        MetaValue value = new MetaValue(newKey);

        // And adding it to the meta map
        // LOGGER.debug("Metakeypair setup");
        getBucketTransaction().getMetaBucket().put(key, value);

        // Creating and setting the headerdata.
        FileData headerData = new FileData(newKey, buffer.array(), false);

        getBucketTransaction().setData(headerData);

        // Creating and setting following datas based on the file size.
        FileData data;

        int currentReadingAmount = 0;
        // LOGGER.info("Iterating file content");
        while ((currentReadingAmount = ch.read(buffer = ByteBuffer.allocate(FileData.FILENODESIZE))) > 0) {
            // LOGGER.debug("Curr. read amount: " + currentReadingAmount);
            byte[] slice = Arrays.copyOf(buffer.array(), currentReadingAmount);

            long dataKey = getBucketTransaction().incrementDataKey();
            data = new FileData(dataKey, slice, false);

            getBucketTransaction().setData(data);

            readingAmount += currentReadingAmount;
        }

        ByteArrayDataOutput size = ByteStreams.newDataOutput();
        size.writeInt(readingAmount);

        data = new FileData(getBucketTransaction().incrementDataKey(), size.toByteArray(), true);

        getBucketTransaction().setData(data);

        Preconditions.checkArgument(getBucketTransaction().getData(newKey) != null);
        lock.release();
        ch.close();
    }
1201528
private void addFileEntry(String entryName, InputStream inputStream) throws IOException {
		// write lazily the manifest before adding the first file
		if (manifest != null) {
			addManifestEntry();
		}

		ZipEntry entry = new ZipEntry(entryName);
		filesArchive.putNextEntry(entry);

		inputStream = new BufferedInputStream(inputStream);
		try {
			byte[] buffer = new byte[BUFFER_SIZE];
			for (;;) {
				int bytesRead = inputStream.read(buffer);
				if (bytesRead <= 0) {
					break;
				}
				write(buffer, 0, bytesRead);
			}
		} finally {
			Files.close(inputStream);
			filesArchive.closeEntry();
		}
	}
98772
public void add(String file, String contents) throws IOException {
		FileUtils.writeStringToFile(tempDir.resolve(file).toFile(), contents);
	}
309274
public void addFile(String zipEntry, String filename) throws IOException {
		addFile(zipEntry, new File(filename));
	}
5635
private void includeFile(File file)
        throws IOException
    {
        if (!file.exists())
            throw new FileNotFoundException(file.toString());
        
        if (file.isDirectory())
        {
            List list = new List(List.Unordered);       
            String[] ls = file.list();
            for (int i=0 ; i< ls.length ; i++)
                list.add(ls[i]);
            StringWriter sw = new StringWriter();
            list.write(sw);
            reader = new StringReader(sw.toString());
        }
        else
        {
            reader = new BufferedReader(new FileReader(file));
        }
    }