Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs

public Class Truncate

extends Task
Class Inheritance
Imports
java.io.File, .IOException, .RandomAccessFile, org.apache.tools.ant.BuildException, .Project, .Task, org.apache.tools.ant.types.Path, .Resource, .ResourceCollection, org.apache.tools.ant.types.resources.FileProvider, .FileResource, org.apache.tools.ant.util.FileUtils

Set the length of one or more files, as the intermittently available truncate Unix utility/function.
Since
Ant 1.7.1

Field Summary

Modifier and TypeField and Description
private Long
private static final int
private boolean
private static final FileUtils
private static final byte[]
private static final String
private Long
private boolean
private static final String
private Path
private static final String
private static final Long
Inherited from org.apache.tools.ant.Task:
targettaskNametaskTypewrapper

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(ResourceCollection
the ResourceCollection to add.
rc
)

Add a nested (filesystem-only) ResourceCollection.

public void
execute()

Overrides org.apache.tools.ant.Task.execute.

Called by the project to let the task do its work.
private synchronized Path
private void
public void
setAdjust(Long
(positive or negative) adjustment amount.
adjust
)

Set the amount by which files' lengths should be adjusted.

public void
setCreate(boolean
boolean, default true.
create
)

Set whether to create nonexistent files.

public void
setFile(File
the single File
f
)

Set a single target File.

public void
setLength(Long
(positive) adjustment amount.
length
)

Set the length to which files should be set.

public void
setMkdirs(boolean
boolean, default false.
mkdirs
)

Set whether, when creating nonexistent files, nonexistent directories should also be created.

private boolean
Inherited from org.apache.tools.ant.Task:
bindToOwnergetOwningTargetgetRuntimeConfigurableWrappergetTaskNamegetTaskTypegetWrapperhandleErrorFlushhandleErrorOutputhandleFlushhandleInputhandleOutputinitisInvalidloglogloglogmaybeConfigureperformreconfiguresetOwningTargetsetRuntimeConfigurableWrappersetTaskNamesetTaskType

Field Detail

adjustback to summary
private Long adjust
BUFFER_SIZEback to summary
private static final int BUFFER_SIZE
createback to summary
private boolean create
FILE_UTILSback to summary
private static final FileUtils FILE_UTILS
FILL_BUFFERback to summary
private static final byte[] FILL_BUFFER
INVALID_LENGTHback to summary
private static final String INVALID_LENGTH
lengthback to summary
private Long length
mkdirsback to summary
private boolean mkdirs
NO_CHILDback to summary
private static final String NO_CHILD
pathback to summary
private Path path
READ_WRITEback to summary
private static final String READ_WRITE
ZEROback to summary
private static final Long ZERO

Constructor Detail

Truncateback to summary
public Truncate()

Method Detail

addback to summary
public void add(ResourceCollection rc)

Add a nested (filesystem-only) ResourceCollection.

Parameters
rc:ResourceCollection

the ResourceCollection to add.

executeback to summary
public void execute()

Overrides org.apache.tools.ant.Task.execute.

Doc from org.apache.tools.ant.Task.execute.

Called by the project to let the task do its work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running "ant target1 target2" will run all tasks in target3 twice..

getPathback to summary
private synchronized Path getPath()
processback to summary
private void process(File f)
setAdjustback to summary
public void setAdjust(Long adjust)

Set the amount by which files' lengths should be adjusted. It is permissible to append K / M / G / T / P.

Parameters
adjust:Long

(positive or negative) adjustment amount.

setCreateback to summary
public void setCreate(boolean create)

Set whether to create nonexistent files.

Parameters
create:boolean

boolean, default true.

setFileback to summary
public void setFile(File f)

Set a single target File.

Parameters
f:File

the single File

setLengthback to summary
public void setLength(Long length)

Set the length to which files should be set. It is permissible to append K / M / G / T / P.

Parameters
length:Long

(positive) adjustment amount.

setMkdirsback to summary
public void setMkdirs(boolean mkdirs)

Set whether, when creating nonexistent files, nonexistent directories should also be created.

Parameters
mkdirs:boolean

boolean, default false.

shouldProcessback to summary
private boolean shouldProcess(File f)