Package kilim.analysis
Class FileLister
- java.lang.Object
-
- kilim.analysis.FileLister
-
- All Implemented Interfaces:
java.lang.Iterable<FileLister.Entry>
public class FileLister extends java.lang.Object implements java.lang.Iterable<FileLister.Entry>
Utility class to present a uniform iterator interface for file containers; presently includes directories and jar files.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFileLister.Entry
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.ref.WeakReference<FileContainer>containerRefweak ref to a container to avoid hanging on to an open jar file.(package private) java.lang.Stringname
-
Constructor Summary
Constructors Constructor Description FileLister(java.lang.String dirOrJarName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancheck(java.lang.String src, java.lang.String dst)check if dst is up to date with src, ie at least as newprivate FileContainergetContainer()java.util.Iterator<FileLister.Entry>iterator()FileLister.Entryopen(java.lang.String relativeFileName)private FileContaineropenJar(java.lang.String jarFile)
-
-
-
Field Detail
-
containerRef
volatile java.lang.ref.WeakReference<FileContainer> containerRef
weak ref to a container to avoid hanging on to an open jar file.
-
name
java.lang.String name
-
-
Method Detail
-
open
public FileLister.Entry open(java.lang.String relativeFileName) throws java.io.IOException
- Parameters:
relativeFileName-- Returns:
- if the relativeFileName exists in the directory or jar represented by FileLister object open it. If not return null.
- Throws:
java.io.IOException
-
getContainer
private FileContainer getContainer() throws java.io.IOException
- Throws:
java.io.IOException
-
openJar
private FileContainer openJar(java.lang.String jarFile) throws java.io.IOException
- Throws:
java.io.IOException
-
iterator
public java.util.Iterator<FileLister.Entry> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<FileLister.Entry>
-
check
public static boolean check(java.lang.String src, java.lang.String dst)check if dst is up to date with src, ie at least as new- Parameters:
src- the source filenamedst- the destination filename- Returns:
- true if dst exists and is at least as new as src
-
-