public class Dir extends DirEntry
DirEntry.Type
Modifier | Constructor and Description |
---|---|
|
Dir(java.nio.file.Path dir,
boolean follow,
String[] exclude_globs,
Pattern[] exclude_regex,
boolean hidden)
Convinience constructor to create a new directory worker instance.
|
|
Dir(java.nio.file.Path dir,
PathFilter filter)
Create a new directory worker instance.
|
protected |
Dir(java.nio.file.Path dir,
PathFilter filter,
java.nio.file.attribute.BasicFileAttributes attrs)
Create a new directory worker instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getCount()
Get the number of entries for this instance.
|
int |
getDirCount()
Get the number of sub directories for this instance.
|
TreeMap<String,Dir> |
getDirMap()
Get a map of all sub directories, keyed by their basename.
|
Dir[] |
getDirs()
Get a copy of the list of all sub directory entries for this instance
sorted by its name.
|
DirEntry[] |
getEntries()
Get a copy of the list of all entries for this instance grouped by sub
directories and none-sub directories, sorted by its name.
|
int |
getNoDirCount()
Get the number of none-sub directories for this instance.
|
TreeMap<String,DirEntry> |
getNoDirMap()
Get a map of all none-sub directories, keyed by their basename.
|
DirEntry[] |
getNoDirs()
Get a copy of the list of all none-sub directory entries for this
instance sorted by its name.
|
boolean |
isEmpty()
Check, whether this instance contains dir entries.
|
void |
list(PrintStream out,
String format,
com.ehsbe.ddiff.Analyzer.Result result,
StringBuilder prefix,
boolean recursive)
List all entries of this instance (directories first), ordered by its name.
|
public Dir(java.nio.file.Path dir, boolean follow, String[] exclude_globs, Pattern[] exclude_regex, boolean hidden)
dir
- the anchor for this instancefollow
- if true
folow symlinksexclude_globs
- globbing patterns for pathnames to ignore. Might
be null
.exclude_regex
- regex patterns for pathnames to ignore. Might be
null
.hidden
- if true
ignore hidden entries as wellIllegalArgumentException
- if the given path is null
PathFilter
,
DirEntry
public Dir(java.nio.file.Path dir, PathFilter filter)
dir
- the anchor for this instancefilter
- exclude filterIllegalArgumentException
- if the given path is null
PathFilter
,
DirEntry
protected Dir(java.nio.file.Path dir, PathFilter filter, java.nio.file.attribute.BasicFileAttributes attrs)
dir
- the anchor for this instancefilter
- exclude filterattrs
- the file attributes associated with this instance. If
null
, gets determined automatically, using the
LinkOption.NOFOLLOW_LINKS
.IllegalArgumentException
- if the given path is null
DirEntry
,
PathFilter
public int getDirCount()
public Dir[] getDirs()
public TreeMap<String,Dir> getDirMap()
public int getNoDirCount()
public DirEntry[] getNoDirs()
public TreeMap<String,DirEntry> getNoDirMap()
public int getCount()
public DirEntry[] getEntries()
public boolean isEmpty()
true
, if this instance contains at least on entry.public void list(PrintStream out, String format, com.ehsbe.ddiff.Analyzer.Result result, StringBuilder prefix, boolean recursive)
out
- where to write the listformat
- format to use for printing. Must accept 4 %s.
Ignored if null
or result is null
..result
- result to print, when printing formatted entries.
Ignored if null
of format is null
.prefix
- prefix, which should be used for each print out.recursive
- if true
, cycle through sub directoeries as well.Created by Jens Elkner