uk.org.ogsadai.client.toolkit.activity.files
Class FileReplace

java.lang.Object
  |
  +--uk.org.ogsadai.client.toolkit.activity.RequestComponent
        |
        +--uk.org.ogsadai.client.toolkit.activity.Activity
              |
              +--uk.org.ogsadai.client.toolkit.activity.files.FileWriting
                    |
                    +--uk.org.ogsadai.client.toolkit.activity.files.FileReplace

public class FileReplace
extends FileWriting

A file writing activity which replaces a particular range of bytes in a file with a string, which may be longer or shorter than the chosen range of bytes.

If a constructor with a text parameter is not used, it is expected that the setInput method will be called in order to register that the input will be taken from another activity's output. If a constructor with a text parameter is used, any input registered via setInput is ignored.

Author:
The OGSA-DAI Project Team

Field Summary
 
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.files.FileWriting
APPEND, BOF, DELETE, EOF, INSERT, mAction, mFilename, mLength, mMatch, mOffset, mPerLine, mRegexp, mText, NONE_SPECIFIED, PER_FILE, PER_LINE, REPLACE, TO_EOF
 
Constructor Summary
FileReplace(java.lang.String filename, int offset, int length, boolean perLine)
          Replace a range of bytes within an entire file or within each line of a file with text obtained from another activity.
FileReplace(java.lang.String filename, int offset, int length, boolean perLine, java.lang.String text)
          Replace a range of bytes within an entire file or within each line of a file with particular text.
FileReplace(java.lang.String filename, java.lang.String regexp, java.lang.String match, boolean perLine)
          Replace particular instances of a match of a regular expression in an entire file or within each line of a file with text obtained from the output of another activity.
FileReplace(java.lang.String filename, java.lang.String regexp, java.lang.String match, boolean perLine, java.lang.String text)
          Replace particular instances of a match of a regular expression in an entire file or within each line of a file with particular text.
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.files.FileWriting
actionToString, generateXML, getFilename, getLength, getMatch, getOffset, getRegexp, getText, isPerLine, lengthToString, offsetToString, setFilename, setInput, setLength, setMatch, setOffset, setPerLine, setRegexp, setText, validateParams
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity
addInput, addOutput, addOutputs, getDataResourceID, getDataServiceStub, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setDataServiceStub, setInput
 
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent
getName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileReplace

public FileReplace(java.lang.String filename,
                   java.lang.String regexp,
                   java.lang.String match,
                   boolean perLine,
                   java.lang.String text)
Replace particular instances of a match of a regular expression in an entire file or within each line of a file with particular text.

The instances can be selected using a match expression, which is a comma-separated list of values. The values may be any of:
ValueStringRepresents
Single, positive integers x The integer x
Finite ranges of positive integers x-y The interval [x, y], where x < y
Infinite ranges of positive integers x- The interval [x, infinity)
Strictly increasing infinite sequences of positive integers x1:x2:x3:... The infinite sequence (x1, x2, x3, ...), where x1 < x2 and x2 < x3

Parameters:
filename - the file to replace text in
regexp - the regular expression to match text with
match - an expression denoting which instances of when the regular expression is matched to deal with
perLine - true treats the match expression on a per-line basis;
false treats the match expression on a per-file basis
text - the text to insert

FileReplace

public FileReplace(java.lang.String filename,
                   java.lang.String regexp,
                   java.lang.String match,
                   boolean perLine)
Replace particular instances of a match of a regular expression in an entire file or within each line of a file with text obtained from the output of another activity.

The instances can be selected using a match expression, which is a comma-separated list of values. The values may be any of:
ValueStringRepresents
Single, positive integers x The integer x
Finite ranges of positive integers x-y The interval [x, y], where x < y
Infinite ranges of positive integers x- The interval [x, infinity)
Strictly increasing infinite sequences of positive integers x1:x2:x3:... The infinite sequence (x1, x2, x3, ...), where x1 < x2 and x2 < x3

Parameters:
filename - the file to replace text in
regexp - the regular expression to match text with
match - an expression denoting which instances of when the regular expression is matched to deal with
perLine - true treats the match expression on a per-line basis;
false treats the match expression on a per-file basis

FileReplace

public FileReplace(java.lang.String filename,
                   int offset,
                   int length,
                   boolean perLine,
                   java.lang.String text)
Replace a range of bytes within an entire file or within each line of a file with particular text.

Parameters:
filename - the file to replace text in
offset - the non-negative offset of start of the range of bytes, or FileWriting.BOF, or FileWriting.EOF
length - the non-negative length of the range of bytes, or FileWriting.TO_EOF
perLine - true treats the offset as an offset from the start of the line;
false treats the offset as an offset from the start of the file
text - the text to insert
Throws:
java.lang.IllegalArgumentException - if the filename is null or the offset or length are outside their valid bounds

FileReplace

public FileReplace(java.lang.String filename,
                   int offset,
                   int length,
                   boolean perLine)
Replace a range of bytes within an entire file or within each line of a file with text obtained from another activity.

Parameters:
filename - the file to insert text into
offset - the non-negative offset of start of the range of bytes, or FileWriting.BOF, or FileWriting.EOF
length - the non-negative length of the range of bytes, or FileWriting.TO_EOF
perLine - true treats the offset as an offset from the start of the line;
false treats the offset as an offset from the start of the file
Throws:
java.lang.IllegalArgumentException - if the filename is null or the offset or length are outside their valid bounds