Package ise.antelope.tasks
Class SplitTask
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- org.apache.tools.ant.Task
-
- ise.antelope.tasks.SplitTask
-
- All Implemented Interfaces:
java.lang.Cloneable
public class SplitTask extends org.apache.tools.ant.Task
This task is similar to the Unix/Linux split utility, it splits a file into a number of smaller pieces. It will also split a property value or a string.- Since:
- Ant 1.6
- Version:
- $Revision: 157 $
-
-
Field Summary
Fields Modifier and Type Field Description static int
BUFFER_SIZE
Buffer size for read and write operations.
-
Constructor Summary
Constructors Constructor Description SplitTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute()
Split the given property, value, or file into pieces.void
setBytes(int b)
Set the number of bytes per part.void
setFailonerror(boolean fail)
Determines whether the build should fail if there is an error.void
setFile(java.io.File f)
Split the contents of the given file.void
setLines(int x)
Set the number of lines per part, default is 1000.void
setOutputdir(java.io.File d)
Where to put the parts.void
setPrefix(java.lang.String x)
The start of the file names to write.void
setProperty(java.lang.String p)
Split the text value of the given property.void
setSize(java.lang.String b)
The linux split command allows modifiers: b for 512, k for 1K, m for 1 Meg.void
setValue(java.lang.String v)
Split the given string.-
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
-
-
-
-
Field Detail
-
BUFFER_SIZE
public static final int BUFFER_SIZE
Buffer size for read and write operations.- See Also:
- Constant Field Values
-
-
Method Detail
-
setPrefix
public void setPrefix(java.lang.String x)
The start of the file names to write. Files are named using this string, followed by a "." and a number, e.g. x.0, x.1, etc. The Unix/Linux split uses a letter scheme for the suffix, that is not supported here. Should the dot go away? If the user wants a dot, it could be part of this attribute. Right now, the dot is there, and there is no way for the user to make it go away.- Parameters:
x
- The new prefix value
-
setBytes
public void setBytes(int b)
Set the number of bytes per part. This is not a required parameter, the default is to use lines rather than bytes. Use bytes or lines, not both. In general, use bytes or size for binary files, lines for text files.- Parameters:
b
- number of bytes per part.
-
setSize
public void setSize(java.lang.String b)
The linux split command allows modifiers: b for 512, k for 1K, m for 1 Meg. Use this method for a similar effect. This is not a required parameter, the default is to use lines rather than size. Use bytes or lines, not both. In general, use bytes or size for binary files, lines for text files.- Parameters:
b
- the number of bytes per part, with an optional modifier. If there is no modifier, treat same as setBytes(int). For example, setSize("100k") is the same as setBytes(100 * 1024). Note that the maximum size must be smaller than Integer.MAX_VALUE (2147483647).
-
setLines
public void setLines(int x)
Set the number of lines per part, default is 1000. This is not a required parameter, but is the default setting for splitting. Use bytes or lines, not both. In general, use bytes or size for binary files, lines for text files.- Parameters:
x
- The number of lines per part.
-
setProperty
public void setProperty(java.lang.String p)
Split the text value of the given property. One of property, value, or file are required.- Parameters:
p
- the name of the property whose value will be split.
-
setValue
public void setValue(java.lang.String v)
Split the given string. One of property, value, or file are required.- Parameters:
v
- a string
-
setFile
public void setFile(java.io.File f)
Split the contents of the given file. One of property, value, or file are required.- Parameters:
f
- the name of the file
-
setOutputdir
public void setOutputdir(java.io.File d)
Where to put the parts. If file has been set and output directory has not been set, output to directory containing file.- Parameters:
d
- the output directory
-
setFailonerror
public void setFailonerror(boolean fail)
Determines whether the build should fail if there is an error. Default is true.- Parameters:
fail
- true or false
-
execute
public void execute() throws org.apache.tools.ant.BuildException
Split the given property, value, or file into pieces.- Overrides:
execute
in classorg.apache.tools.ant.Task
- Throws:
org.apache.tools.ant.BuildException
- only if failOnError is true
-
-