consumer | A consumer of strings. |
directoriesCopied | The number of directories copied. |
filesCopied | The number of files copied. |
from | The file to read from. |
input | An input stream. |
name | A name, can be any text. |
output | An output stream. |
to | The file to write to. |
Example 1 | Copy a file. |
Example 2 | Copy a directory. |
Example 3 | Copy from a file to a buffer. |
Example 4 | Copy into a Bean Bus. |
Configured By | ELEMENT |
Access | READ_WRITE |
Required | No. Will be set automatically in a Bean Bus. |
A consumer of strings. Intended for use as the driver in a bus:bus.
Access | READ_ONLY |
Required | Read Only. |
The number of directories copied.
Access | READ_ONLY |
Required | Read Only. |
The number of files copied.
Configured By | ELEMENT |
Access | READ_WRITE |
Required | Yes unless input supplied. |
The file to read from.
Configured By | ELEMENT |
Access | READ_WRITE |
Required | Yes unless from supplied. |
An input stream.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | No. |
A name, can be any text.
Configured By | ELEMENT |
Access | READ_WRITE |
Required | Yes unless to is supplied. |
An output stream.
Configured By | ATTRIBUTE |
Access | READ_WRITE |
Required | Yes unless output supplied. |
The file to write to.
Copy a file.
<oddjob id="this"> <job> <copy to="${work.dir}"> <from> <file file="${base.dir}/test/io/reference/test1.txt"/> </from> </copy> </job> </oddjob>
Copy a directory.
<oddjob id="this"> <job> <copy to="${work.dir}"> <from> <file file="${base.dir}/test/io/reference/a"/> </from> </copy> </job> </oddjob>
Copy from a file to a buffer.
<oddjob id="this"> <job> <sequential> <jobs> <copy name="Copy from a file to a buffer"> <from> <file file="${this.args[0]}/test/io/reference/test1.txt"/> </from> <output> <identify id="buff"> <value> <buffer/> </value> </identify> </output> </copy> <echo id="e" name="What's in the file?">${buff}</echo> </jobs> </sequential> </job> </oddjob>
Copy into a Bean Bus. The lines from the file are copied into the bus where they are mapped with a function that appends 'Foo' before writing them out in another file.
<oddjob id="oddjob"> <job> <sequential> <jobs> <properties> <values> <value key="work.dir" value="${java.io.tmpdir}"/> </values> </properties> <bus:bus xmlns:bus="oddjob:beanbus"> <of> <copy name="Copy from a file to lines"> <from> <file file="${oddjob.dir}/files/Lines.txt"/> </from> </copy> <bus:map> <function> <value value="#{function(x) { return x + 'Foo' }}"/> </function> </bus:map> <bus:collect> <output> <file file="${work.dir}/LinesFoo.txt"/> </output> </bus:collect> </of> </bus:bus> </jobs> </sequential> </job> </oddjob>