package hep.lcio.util;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

/**
 * Miscellaneous java file utilities.
 * @author jeremym
 * @version $Id: FileUtil.java,v 1.3 2007-03-16 00:36:20 jeremy Exp $
 */
public abstract class FileUtil
{
	/**
	 * Reads the lines of file at path fileName into 
	 * an ArrayList.
	 * @param fileName Name of the input file.
	 * @return A List with one String file line per entry.
	 */
	public static List loadFile(String fileName)
	{
		if ((fileName == null) || (fileName == ""))
			throw new IllegalArgumentException("invalid fileName: "+fileName);

		String line;
		ArrayList file = new ArrayList();

		try
		{
			BufferedReader in = new BufferedReader(new FileReader(fileName));

			if (!in.ready())
				throw new IOException();

			while ((line = in.readLine()) != null)
				file.add(line);

			in.close();
		}
		catch (IOException e)
		{
			System.out.println(e);
			return null;
		}

		return file;
	}
	
	/**
	 * Return an array of @see File objects from an array of paths.
	 * @param fstr Array of file paths.
	 * @return Array of File objects.
	 */
	public static File[] createFiles(String[] fstr)
	{
		File[] infiles = new File[fstr.length];
		for (int i = 0; i < fstr.length; i++)
		{
			String ifile = (String) fstr[i];
			infiles[i] = new File(ifile);
		}
		return infiles;
	}
}

@@ -276,29 +276,29 @@
 v 1.
-3
+4
  2007-0
-3-16 00:36:20
+7-24 18:28:42
  jer
@@ -1402,16 +1402,120 @@
 ifile);%0A
+%09%09%09if (!infiles%5Bi%5D.exists())%0A%09%09%09%09throw new RuntimeException(%22File %22 + infiles%5Bi%5D + %22 does not exist!%22);%0A
 %09%09%7D%0A%09%09re

Check for file exists.