FileDocCategorySizeDatePackage
FilterMapper.javaAPI DocApache Ant 1.703060Wed Dec 13 06:16:24 GMT 2006org.apache.tools.ant.types.mappers

FilterMapper

public class FilterMapper extends org.apache.tools.ant.types.FilterChain implements org.apache.tools.ant.util.FileNameMapper
This is a FileNameMapper based on a FilterChain.

Fields Summary
Constructors Summary
Methods Summary
public java.lang.String[]mapFileName(java.lang.String sourceFileName)
Return the result of the filters on the sourcefilename.

param
sourceFileName the filename to map
return
a one-element array of converted filenames, or null if the filterchain returns an empty string.

        try {
            Reader stringReader = new StringReader(sourceFileName);
            ChainReaderHelper helper = new ChainReaderHelper();
            helper.setBufferSize(8192);
            helper.setPrimaryReader(stringReader);
            helper.setProject(getProject());
            Vector filterChains = new Vector();
            filterChains.add(this);
            helper.setFilterChains(filterChains);
            String result = FileUtils.readFully(helper.getAssembledReader());
            if (result.length() == 0) {
                return null;
            } else {
                return new String[] {result};
            }
        } catch (BuildException ex) {
            throw ex;
        } catch (Exception ex) {
            throw new BuildException(ex);
        }
    
public voidsetFrom(java.lang.String from)
From attribute not supported.

param
from a string
throws
BuildException always

        throw new UnsupportedAttributeException(
            "filtermapper doesn't support the \"from\" attribute.", "from");
    
public voidsetTo(java.lang.String to)
From attribute not supported.

param
to a string
throws
BuildException always

        throw new UnsupportedAttributeException(
            "filtermapper doesn't support the \"to\" attribute.", "to");