java.lang.Cloneable
public class Touch extends Task
If the file to touch doesn't exist, an empty one is created.
Modifier and Type | Class | Description |
---|---|---|
static interface |
Touch.DateFormatFactory |
Modifier and Type | Field | Description |
---|---|---|
static Touch.DateFormatFactory |
DEFAULT_DF_FACTORY |
Provides access to DateUtils.EN_US_DATE_FORMAT_MIN (primary) and
DateUtils.EN_US_DATE_FORMAT_SEC (fallback).
|
description, location, project
Constructor | Description |
---|---|
Touch() |
Modifier and Type | Method | Description |
---|---|---|
void |
add(ResourceCollection rc) |
Add a collection of resources to touch.
|
void |
add(FileNameMapper fileNameMapper) |
Add a
FileNameMapper . |
void |
addConfiguredMapper(Mapper mapper) |
Add a
Mapper . |
void |
addFilelist(FileList list) |
Add a filelist to touch.
|
void |
addFileset(FileSet set) |
Add a set of files to touch.
|
protected void |
checkConfiguration() |
Check that this task has been configured properly.
|
void |
execute() |
Execute the touch operation.
|
void |
setDatetime(java.lang.String dateTime) |
Set the new modification time of file(s) touched
in the format "MM/DD/YYYY HH:MM AM or PM"
or "MM/DD/YYYY HH:MM:SS AM or PM".
|
void |
setFile(java.io.File file) |
Sets a single source file to touch.
|
void |
setMillis(long millis) |
Set the new modification time of file(s) touched
in milliseconds since midnight Jan 1 1970.
|
void |
setMkdirs(boolean mkdirs) |
Set whether nonexistent parent directories should be created
when touching new files.
|
void |
setPattern(java.lang.String pattern) |
Set the format of the datetime attribute.
|
void |
setVerbose(boolean verbose) |
Set whether the touch task will report every file it creates;
defaults to
true . |
protected void |
touch() |
Does the actual work; assumes everything has been checked by now.
|
protected void |
touch(java.io.File file) |
Deprecated.
since 1.6.x.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
public static final Touch.DateFormatFactory DEFAULT_DF_FACTORY
public void setFile(java.io.File file)
file
- the File
to touch.public void setMillis(long millis)
millis
- the long
timestamp to use.public void setDatetime(java.lang.String dateTime)
dateTime
- the String
date in the specified format.public void setMkdirs(boolean mkdirs)
mkdirs
- boolean
whether to create parent directories.public void setVerbose(boolean verbose)
true
.verbose
- boolean
flag.public void setPattern(java.lang.String pattern)
pattern
- the SimpleDateFormat
-compatible format pattern.public void addConfiguredMapper(Mapper mapper)
Mapper
.mapper
- the Mapper
to add.public void add(FileNameMapper fileNameMapper) throws BuildException
FileNameMapper
.fileNameMapper
- the FileNameMapper
to add.BuildException
- if multiple mappers are added.public void addFileset(FileSet set)
set
- the Fileset
to add.public void addFilelist(FileList list)
list
- the Filelist
to add.public void add(ResourceCollection rc)
rc
- the collection to add.protected void checkConfiguration() throws BuildException
BuildException
- if configuration errors are detected.public void execute() throws BuildException
execute
in class Task
BuildException
- if an error occurs.protected void touch() throws BuildException
BuildException
- if an error occurs.@Deprecated protected void touch(java.io.File file)
file
- file to touchBuildException
- on error