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:
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
FieldsModifier and TypeFieldDescriptionstatic final int
Buffer size for read and write operations.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Split the contents of the given file.void
setLines
(int x) Set the number of lines per part, default is 1000.void
setOutputdir
(File d) Where to put the parts.void
The start of the file names to write.void
Split the text value of the given property.void
The linux split command allows modifiers: b for 512, k for 1K, m for 1 Meg.void
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
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Field Details
-
BUFFER_SIZE
public static final int BUFFER_SIZEBuffer size for read and write operations.- See Also:
-
-
Constructor Details
-
SplitTask
public SplitTask()
-
-
Method Details
-
setPrefix
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
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
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
Split the given string. One of property, value, or file are required.- Parameters:
v
- a string
-
setFile
Split the contents of the given file. One of property, value, or file are required.- Parameters:
f
- the name of the file
-
setOutputdir
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.BuildExceptionSplit 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
-