|
Knopflerfish OSGi 2.4.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.knopflerfish.ant.taskdefs.bundle.ByteFormatterTask
public class ByteFormatterTask
Sets a property to a formatted value in ki, Mi, Gi, ... with an optional unit. Here ki is short for kibi, (a contraction of kilo binary) see http://en.wikipedia.org/wiki/Kibibyte for a detailed explanation.
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" />
Field Summary |
---|
Fields inherited from class org.apache.tools.ant.Task |
---|
target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
---|
description, location, project |
Constructor Summary | |
---|---|
ByteFormatterTask()
Default constructor. |
Method Summary | |
---|---|
void |
execute()
Format value using ki, Mi, Gi, ... |
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. |
Methods inherited from class org.apache.tools.ant.Task |
---|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
---|
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ByteFormatterTask()
Method Detail |
---|
public 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.Task
BuildException
- if the manifest cannot be written.
|
Knopflerfish OSGi 2.4.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |