public class ArchiveEntryFactory
extends java.lang.Object
Constructor and Description |
---|
ArchiveEntryFactory() |
ArchiveEntryFactory(java.util.List packets) |
Modifier and Type | Method and Description |
---|---|
protected void |
add(ArchiveEntry packet) |
java.util.List |
getPackets() |
protected ArchiveEntry |
newArchiveEntry(java.lang.String name,
java.net.URL url) |
void |
recurseInDirectories(java.net.URL[] dirs) |
void |
recurseInDirectory(java.lang.String prefix,
java.net.URL dir)
This is the recursive part of the algorithm that builds up the
List of CdaPacket objects representing an
entire directory tree. |
void |
recurseInDirectory(java.net.URL dir)
This method takes an
URL argument that represents a
directory and recurses into it, building up a List of
ArchiveEntryFactory objects that provide entry names that are
relative to the directory associated with fully qualified URL s for the resources. |
void |
recurseInPath(URLPath path) |
protected boolean |
shouldAdd(java.net.URL url) |
protected boolean |
shouldRecurseInto(java.net.URL url) |
static ArchiveEntry[] |
toArray(java.util.Collection archiveEntries)
Converts the given
Collection of ArchiveEntry
objects into an array of ArchiveEntry objects. |
public ArchiveEntryFactory()
public ArchiveEntryFactory(java.util.List packets)
public java.util.List getPackets()
public void recurseInDirectory(java.net.URL dir)
URL
argument that represents a
directory and recurses into it, building up a List
of
ArchiveEntryFactory
objects that provide entry names that are
relative to the directory associated with fully qualified URL
s for the resources. This method is especially useful for
copying directory trees into a jar file.dir
- The directory where the recursion begins. All entry
names in the returned List
will be relative to this
directory.public void recurseInPath(URLPath path)
public void recurseInDirectories(java.net.URL[] dirs)
public void recurseInDirectory(java.lang.String prefix, java.net.URL dir)
List
of CdaPacket
objects representing an
entire directory tree.prefix
- entry name prefix; must end with "/" to produce
correct results.dir
- current directory being recursed.protected ArchiveEntry newArchiveEntry(java.lang.String name, java.net.URL url)
public static ArchiveEntry[] toArray(java.util.Collection archiveEntries)
Collection
of ArchiveEntry
objects into an array of ArchiveEntry
objects. Any nulls
or objects in archiveEntries
that cannot be cast
to ArchiveEntry
are skipped and will not be in the returned
array.protected boolean shouldRecurseInto(java.net.URL url)
protected boolean shouldAdd(java.net.URL url)
protected void add(ArchiveEntry packet)