public class DataFileSystemNodeVisitor extends Object implements FileSystemNodeVisitor<FileSystemNodeInfo>
A visitor for the node tree based on the data configuration.
The visitor removes branches which only contain nodes which have been created as a dependency. It also counts the size of all files.
Constructor and Description |
---|
DataFileSystemNodeVisitor(org.apache.maven.plugin.logging.Log log,
DebianPackageBuilder builder,
Charset defaultEncoding,
Replacements replacements,
Context context)
Creates a visitor.
|
Modifier and Type | Method and Description |
---|---|
long |
getDirectories()
Returns the number of visited directories.
|
long |
getFiles()
Returns the number of visited files.
|
long |
getSize()
Returns the size of all visited files.
|
long |
getSymbolicLinks()
Returns the number of visited symbolic links.
|
boolean |
isProcess()
Returns the flag if at least one file has to be processed.
|
FileSystemNodeVisitResult |
postVisitDirectory(FileSystemNode<FileSystemNodeInfo> node)
Invoked for a directory node after children in the directory node, and
all of their descendants, have been visited.
|
FileSystemNodeVisitResult |
preVisitDirectory(FileSystemNode<FileSystemNodeInfo> node)
Invoked for a directory node before children of the directory node are
visited.
|
FileSystemNodeVisitResult |
visitFile(FileSystemNode<FileSystemNodeInfo> node)
Invoked for a file node in a directory node.
|
public DataFileSystemNodeVisitor(org.apache.maven.plugin.logging.Log log, DebianPackageBuilder builder, Charset defaultEncoding, Replacements replacements, Context context)
Creates a visitor.
log
- The logging.builder
- The builder.defaultEncoding
- The default encoding.replacements
- The replacements.context
- The context.IllegalArgumentException
- If any of the parameters are null
.public long getSize()
Returns the size of all visited files.
public long getFiles()
Returns the number of visited files.
public long getDirectories()
Returns the number of visited directories.
public long getSymbolicLinks()
Returns the number of visited symbolic links.
public boolean isProcess()
Returns the flag if at least one file has to be processed.
true
, if at least one file has to be
processed, false
otherwise.public FileSystemNodeVisitResult preVisitDirectory(FileSystemNode<FileSystemNodeInfo> node) throws IOException
FileSystemNodeVisitor
Invoked for a directory node before children of the directory node are visited.
If this method returns FileSystemNodeVisitResult.CONTINUE
, then
children of the directory node are visited. If this method returns
FileSystemNodeVisitResult.SKIP_SUBTREE
or
FileSystemNodeVisitResult.SKIP_SIBLINGS
then children of the
directory node (and any descendants) will not be visited.
preVisitDirectory
in interface FileSystemNodeVisitor<FileSystemNodeInfo>
node
- The directory node.IOException
- If an I/O error occurs.public FileSystemNodeVisitResult visitFile(FileSystemNode<FileSystemNodeInfo> node) throws IOException
FileSystemNodeVisitor
Invoked for a file node in a directory node.
visitFile
in interface FileSystemNodeVisitor<FileSystemNodeInfo>
node
- The file node.IOException
- If an I/O error occurs.public FileSystemNodeVisitResult postVisitDirectory(FileSystemNode<FileSystemNodeInfo> node) throws IOException
FileSystemNodeVisitor
Invoked for a directory node after children in the directory node, and
all of their descendants, have been visited. This method is also invoked
when iteration of the directory completes prematurely (by a
FileSystemNodeVisitor.visitFile(FileSystemNode)
method returning
FileSystemNodeVisitResult.SKIP_SIBLINGS
directory).
postVisitDirectory
in interface FileSystemNodeVisitor<FileSystemNodeInfo>
node
- The directory node.IOException
- If an I/O error occurs.Copyright © 2015–2019. All rights reserved.