org.knopflerfish.ant.taskdefs.bundle
public class ByteFormatterTask extends org.apache.tools.ant.Task
| Attribute | Description | Required |
| property | The name of the property to assign the formatted value to. | Yes. |
| binaryPrefixURL | An URL pointing to a page explaining the binary unit suffixes. | http://en.wikipedia.org/wiki/Binary_prefix#IEC_standard_prefixes |
| unit | The unit to append to the formatted value. E.g., byte | No, default is the empty string. |
| sep | The string placed between the number and the unit. | No, default is the HTML non-breaking space, " ". |
| value | The value to format. | One of value and file must be given. |
| file | The file whose size is the value to format. | One of value and file must be given. |
<byteformatter value="9093663"
property="myFormatedFilesize"
unit="B" />
<byteformatter file="archive.jar"
property="archive.size"
unit="B" />
| Constructor and Description |
|---|
ByteFormatterTask()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
execute()
Performs the requested formatting.
|
void |
setBinaryPrefixURL(java.lang.String url)
The URL that explains binary prefixes.
|
void |
setFile(java.io.File file)
Set the file to get the size of as the the value to format.
|
void |
setProperty(java.lang.String property)
The name of the property to save the formatted value to.
|
void |
setSep(java.lang.String sep)
The separator between the numeral and the prefixed unit.
|
void |
setUnit(java.lang.String unit)
The unit to append to the formatted value.
|
void |
setValue(long value)
Set the value to format.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypepublic void setProperty(java.lang.String property)
property - the name of the property to set.public void setUnit(java.lang.String unit)
unit - the unit text to append to the formatted value.public void setBinaryPrefixURL(java.lang.String url)
url - The url to let the binary prefix point to.public void setSep(java.lang.String sep)
sep - the separator string.public void setValue(long value)
value - the value to formatpublic void setFile(java.io.File file)
file - the file to return a formatted file size for.public void execute()
execute in class org.apache.tools.ant.TaskBuildException - if the manifest cannot be written.