| java.lang.Object org.apache.tools.ant.util.ResourceUtils
ResourceUtils | public class ResourceUtils (Code) | | This class provides utility methods to process Resources.
since: Ant 1.5.2 |
Method Summary | |
public static int | compareContent(Resource r1, Resource r2, boolean text) Compare the content of two Resources. | public static boolean | contentEquals(Resource r1, Resource r2, boolean text) Compares the contents of two Resources.
Parameters: r1 - the Resource whose content is to be compared. Parameters: r2 - the other Resource whose content is to be compared. Parameters: text - true if the content is to be treated as text anddifferences in kind of line break are to be ignored. | public static void | copyResource(Resource source, Resource dest) Convenience method to copy content from one Resource to another. | public static void | copyResource(Resource source, Resource dest, Project project) Convenience method to copy content from one Resource to another. | public static void | copyResource(Resource source, Resource dest, FilterSetCollection filters, Vector filterChains, boolean overwrite, boolean preserveLastModified, String inputEncoding, String outputEncoding, Project project) Convenience method to copy content from one Resource to another
specifying whether token filtering must be used, whether filter chains
must be used, whether newer destination files may be overwritten and
whether the last modified time of dest file should be made
equal to the last modified time of source . | public static Resource[] | selectOutOfDateSources(ProjectComponent logTo, Resource[] source, FileNameMapper mapper, ResourceFactory targets) Tells which source files should be reprocessed based on the
last modification date of target files.
Parameters: logTo - where to send (more or less) interesting output. Parameters: source - array of resources bearing relative path and lastmodification date. Parameters: mapper - filename mapper indicating how to find the targetfiles. Parameters: targets - object able to map as a resource a relative pathat destination. | public static Resource[] | selectOutOfDateSources(ProjectComponent logTo, Resource[] source, FileNameMapper mapper, ResourceFactory targets, long granularity) Tells which source files should be reprocessed based on the
last modification date of target files.
Parameters: logTo - where to send (more or less) interesting output. Parameters: source - array of resources bearing relative path and lastmodification date. Parameters: mapper - filename mapper indicating how to find the targetfiles. Parameters: targets - object able to map as a resource a relative pathat destination. Parameters: granularity - The number of milliseconds leeway to givebefore deciding a target is out of date. | public static ResourceCollection | selectOutOfDateSources(ProjectComponent logTo, ResourceCollection source, FileNameMapper mapper, ResourceFactory targets, long granularity) Tells which sources should be reprocessed based on the
last modification date of targets.
Parameters: logTo - where to send (more or less) interesting output. Parameters: source - ResourceCollection. Parameters: mapper - filename mapper indicating how to find the target Resources. Parameters: targets - object able to map a relative path as a Resource. Parameters: granularity - The number of milliseconds leeway to givebefore deciding a target is out of date. | public static void | setLastModified(Touchable t, long time) Set the last modified time of an object implementing
org.apache.tools.ant.types.resources.Touchable . |
compareContent | public static int compareContent(Resource r1, Resource r2, boolean text) throws IOException(Code) | | Compare the content of two Resources. A nonexistent Resource's
content is "less than" that of an existing Resource; a directory-type
Resource's content is "less than" that of a file-type Resource.
Parameters: r1 - the Resource whose content is to be compared. Parameters: r2 - the other Resource whose content is to be compared. Parameters: text - true if the content is to be treated as text anddifferences in kind of line break are to be ignored. a negative integer, zero, or a positive integer as the firstargument is less than, equal to, or greater than the second. throws: IOException - if the Resources cannot be read. since: Ant 1.7 |
contentEquals | public static boolean contentEquals(Resource r1, Resource r2, boolean text) throws IOException(Code) | | Compares the contents of two Resources.
Parameters: r1 - the Resource whose content is to be compared. Parameters: r2 - the other Resource whose content is to be compared. Parameters: text - true if the content is to be treated as text anddifferences in kind of line break are to be ignored. true if the content of the Resources is the same. throws: IOException - if the Resources cannot be read. since: Ant 1.7 |
copyResource | public static void copyResource(Resource source, Resource dest) throws IOException(Code) | | Convenience method to copy content from one Resource to another.
No filtering is performed.
Parameters: source - the Resource to copy from.Must not be null . Parameters: dest - the Resource to copy to.Must not be null . throws: IOException - if the copying fails. since: Ant 1.7 |
copyResource | public static void copyResource(Resource source, Resource dest, Project project) throws IOException(Code) | | Convenience method to copy content from one Resource to another.
No filtering is performed.
Parameters: source - the Resource to copy from.Must not be null . Parameters: dest - the Resource to copy to.Must not be null . Parameters: project - the project instance. throws: IOException - if the copying fails. since: Ant 1.7 |
copyResource | public static void copyResource(Resource source, Resource dest, FilterSetCollection filters, Vector filterChains, boolean overwrite, boolean preserveLastModified, String inputEncoding, String outputEncoding, Project project) throws IOException(Code) | | Convenience method to copy content from one Resource to another
specifying whether token filtering must be used, whether filter chains
must be used, whether newer destination files may be overwritten and
whether the last modified time of dest file should be made
equal to the last modified time of source .
Parameters: source - the Resource to copy from.Must not be null . Parameters: dest - the Resource to copy to.Must not be null . Parameters: filters - the collection of filters to apply to this copy. Parameters: filterChains - filterChains to apply during the copy. Parameters: overwrite - Whether or not the destination Resource should beoverwritten if it already exists. Parameters: preserveLastModified - Whether or not the last modified time ofthe destination Resource should be set to thatof the source. Parameters: inputEncoding - the encoding used to read the files. Parameters: outputEncoding - the encoding used to write the files. Parameters: project - the project instance. throws: IOException - if the copying fails. since: Ant 1.7 |
selectOutOfDateSources | public static Resource[] selectOutOfDateSources(ProjectComponent logTo, Resource[] source, FileNameMapper mapper, ResourceFactory targets)(Code) | | Tells which source files should be reprocessed based on the
last modification date of target files.
Parameters: logTo - where to send (more or less) interesting output. Parameters: source - array of resources bearing relative path and lastmodification date. Parameters: mapper - filename mapper indicating how to find the targetfiles. Parameters: targets - object able to map as a resource a relative pathat destination. array containing the source files which need to becopied or processed, because the targets are out of date or donot exist. |
selectOutOfDateSources | public static Resource[] selectOutOfDateSources(ProjectComponent logTo, Resource[] source, FileNameMapper mapper, ResourceFactory targets, long granularity)(Code) | | Tells which source files should be reprocessed based on the
last modification date of target files.
Parameters: logTo - where to send (more or less) interesting output. Parameters: source - array of resources bearing relative path and lastmodification date. Parameters: mapper - filename mapper indicating how to find the targetfiles. Parameters: targets - object able to map as a resource a relative pathat destination. Parameters: granularity - The number of milliseconds leeway to givebefore deciding a target is out of date. array containing the source files which need to becopied or processed, because the targets are out of date or donot exist. since: Ant 1.6.2 |
selectOutOfDateSources | public static ResourceCollection selectOutOfDateSources(ProjectComponent logTo, ResourceCollection source, FileNameMapper mapper, ResourceFactory targets, long granularity)(Code) | | Tells which sources should be reprocessed based on the
last modification date of targets.
Parameters: logTo - where to send (more or less) interesting output. Parameters: source - ResourceCollection. Parameters: mapper - filename mapper indicating how to find the target Resources. Parameters: targets - object able to map a relative path as a Resource. Parameters: granularity - The number of milliseconds leeway to givebefore deciding a target is out of date. ResourceCollection. since: Ant 1.7 |
setLastModified | public static void setLastModified(Touchable t, long time)(Code) | | Set the last modified time of an object implementing
org.apache.tools.ant.types.resources.Touchable .
Parameters: t - the Touchable whose modified time is to be set. Parameters: time - the time to which the last modified time is to be set.if this is -1, the current time is used. since: Ant 1.7 |
|
|