Skip to main content
summaryrefslogtreecommitdiffstats
blob: b1f4641e55a4c4e971a067ed5d787d52d5c49ff6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*******************************************************************************
 * Copyright (c) 2001, 2005 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.j2ee.commonarchivecore.internal.helpers;



import java.io.InputStream;
import java.util.List;
import java.util.NoSuchElementException;

import org.eclipse.jst.j2ee.commonarchivecore.internal.CommonArchiveResourceHandler;
import org.eclipse.jst.j2ee.commonarchivecore.internal.File;


public class FileIteratorImpl implements FileIterator {
	protected List files;
	protected int position = 0;

	/**
	 * Insert the method's description here. Creation date: (05/02/01 6:16:52 PM)
	 */
	public FileIteratorImpl() {
		//Default
	}

	public FileIteratorImpl(List theFiles) {
		super();
		files = theFiles;
	}

	public InputStream getInputStream(File aFile) throws java.io.IOException, java.io.FileNotFoundException {
		return aFile.getInputStream();
	}

	public boolean hasNext() {
		return position < files.size();
	}

	public File next() {
		if (!hasNext())
			throw new NoSuchElementException(CommonArchiveResourceHandler.End_of_list_reached_EXC_); // = "End of list reached"
		return (File) files.get(position++);
	}
}

Back to the top