Top Description Fields Constructors Methods
org.apache.tools.ant.types.mappers

public Class CutDirsMapper

extends Object
implements FileNameMapper
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.util.FileNameMapper
Imports
java.io.File, org.apache.tools.ant.BuildException, org.apache.tools.ant.util.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
simplify copy with regexpmapper

Field Summary

Modifier and TypeField and Description
private int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String[]
mapFileName(final String
the name of the source file relative to some given basedirectory. Might be null for resources that don't provide a name.
sourceFileName
)

Implements org.apache.tools.ant.util.FileNameMapper.mapFileName.

Returns an array containing the target filename(s) for the given source file.
public void
setDirs(final int
int
dirs
)

The number of leading directories to cut.

public void
setFrom(final String
ignored.
ignore
)

Implements org.apache.tools.ant.util.FileNameMapper.setFrom.

Empty implementation.
public void
setTo(final String
ignored.
ignore
)

Implements org.apache.tools.ant.util.FileNameMapper.setTo.

Empty implementation.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dirsback to summary
private int dirs

Constructor Detail

CutDirsMapperback to summary
public CutDirsMapper()

Method Detail

mapFileNameback to summary
public String[] mapFileName(final String sourceFileName)

Implements org.apache.tools.ant.util.FileNameMapper.mapFileName.

Doc from org.apache.tools.ant.util.FileNameMapper.mapFileName.

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.

.
Parameters
sourceFileName:String

the name of the source file relative to some given basedirectory. Might be null for resources that don't provide a name.

Returns:String[]

an array of strings if the rule applies to the source file, or null if it does not.

Annotations
@Override
setDirsback to summary
public void setDirs(final int dirs)

The number of leading directories to cut.

Parameters
dirs:int

int

setFromback to summary
public void setFrom(final String ignore)

Implements org.apache.tools.ant.util.FileNameMapper.setFrom.

Empty implementation.

Parameters
ignore:String

ignored.

Annotations
@Override
setToback to summary
public void setTo(final String ignore)

Implements org.apache.tools.ant.util.FileNameMapper.setTo.

Empty implementation.

Parameters
ignore:String

ignored.

Annotations
@Override