home *** CD-ROM | disk | FTP | other *** search
- package netscape.netcast;
-
- import java.io.File;
- import java.util.Enumeration;
- import java.util.NoSuchElementException;
-
- final class MappedFileCacheEnumeration implements Enumeration {
- MappedFileCache cache;
- File base;
- File dir;
- Object next;
- int slot;
-
- MappedFileCacheEnumeration(MappedFileCache cache) {
- this.cache = cache;
- this.dir = cache.dir;
- this.next = this.getNext();
- }
-
- Object getNext() {
- return this.slot < this.cache.count ? new MappedFileCacheFile(this.cache, this.dir, this.cache.makeName(this.cache.getName(this.slot)), -1L, this.cache.getChecksum(this.slot++)) : null;
- }
-
- public boolean hasMoreElements() {
- return this.next != null;
- }
-
- public Object nextElement() {
- Object file = this.next;
- if (file == null) {
- throw new NoSuchElementException();
- } else {
- this.next = this.getNext();
- return file;
- }
- }
- }
-