Class CutDirsMapper

All Implemented Interfaces:

public class CutDirsMapper extends Object implements FileNameMapper
A mapper that strips of the a configurable number of leading directories from a file name.

This mapper was inspired by a user-list thread that mentioned wget's --cut-dirs option.

See Also:
  • Constructor Details

    • CutDirsMapper

      public CutDirsMapper()
  • Method Details

    • setDirs

      public void setDirs(int dirs)
      The number of leading directories to cut.
      dirs - int
    • setFrom

      public void setFrom(String ignore)
      Empty implementation.
      Specified by:
      setFrom in interface FileNameMapper
      ignore - ignored.
    • setTo

      public void setTo(String ignore)
      Empty implementation.
      Specified by:
      setTo in interface FileNameMapper
      ignore - ignored.
    • mapFileName

      public String[] mapFileName(String sourceFileName)
      Returns an array containing the target filename(s) for the given source file.

      if the given rule doesn't apply to the source file, implementation must return null. SourceFileScanner will then omit the source file in question.

      Specified by:
      mapFileName in interface FileNameMapper
      sourceFileName - the name of the source file relative to some given basedirectory. Might be null for resources that don't provide a name.
      an array of strings if the rule applies to the source file, or null if it does not.