FileDocCategorySizeDatePackage
AdAccessor.javaAPI DocExample751Sat Dec 02 19:43:52 GMT 2000jabadot

AdAccessor

public class AdAccessor extends Object
Class for accessing the list of Ads.

Fields Summary
Constructors Summary
Methods Summary
static java.util.ArrayListload(java.io.File file)

		ArrayList list = new ArrayList();
		BufferedReader is = new BufferedReader(new FileReader(file));
		String line;
		while ((line = is.readLine()) != null) {
			// Must use something that doesn't occur in URLs as delim
			// Can't serve "file://C|/foo/bar" (which is at any rate invalid)
			StringTokenizer st = new StringTokenizer(line, "|");
			String url = st.nextToken();
			String alt = st.nextToken();
			String img = st.nextToken();
			System.out.println(url + "--" + alt + "--" + img);
			list.add(new Ad(url, alt, img));
		}
		is.close();
		return list;