|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.client.toolkit.activity.RequestComponent | +--uk.org.ogsadai.client.toolkit.activity.Activity | +--uk.org.ogsadai.client.toolkit.activity.indexedfiles.ReadFile
This activity retrieves the contents of files. Files can either be plain text (in which case the start line and number of lines to be read can be specified) or binary (the default, in which case the start byte and number of bytes to be read can be specified).
The file path is relative to the root of a file system data service resource.
Alternatively the activity can receive input from another activity. The input must be a sequence of readFile activity elements. This method can be used to read and retrieve a number of files in sequence.
The activity has one output - the contents of the files that have been read. This can be base64 encoded, if required.
The getOutput
method can be used to obtain the data output
from the activity.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement |
private boolean |
mBase64encode
Is output to be base64 encoded? |
private java.lang.String |
mFilename
Relative path of file to read |
private boolean |
mIsBinary
Is the file to be read as bytes? |
private long |
mLength
Number of lines/bytes to read |
private long |
mOffset
Index of first line/byte to read |
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.Activity |
|
Fields inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent |
|
Constructor Summary | |
ReadFile()
Constructor. |
|
ReadFile(ActivityOutput input)
Constructor. |
|
ReadFile(java.lang.String filename)
Constructor. |
Method Summary | |
protected java.lang.String |
generateXML()
Generates the XML representing the activity. |
java.lang.String |
getFilename()
Gets relative path to file to be read. |
long |
getLength()
Gets number of bytes (if isBinary is
true ) or lines to be read. |
long |
getOffset()
Gets position of first byte (if isBinary is
true ) or line to be read. |
ActivityOutput |
getOutput()
Get this activity's output - the data. |
boolean |
isBase64encoded()
Indicates whether activity output is to be base64 encoded. |
boolean |
isBinary()
Gets flag indicating if file is a binary file. |
void |
setBase64encode(boolean base64encode)
Sets whether activity output is to be base64 encoded. |
void |
setBinary(boolean isBinary)
Sets flag indicating if file is a binary file. |
void |
setFilename(java.lang.String filename)
Sets relative path to file to be read. |
void |
setInput(ActivityOutput input)
Sets the input of this activity to be the output from another activity that will provide the data. |
void |
setLength(long length)
Sets number of bytes (if isBinary is true )
or lines to be read. |
void |
setOffset(long offset)
Sets the position of the first byte (if isBinary is
true ) or the first line to be read. |
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.Activity |
addInput, addOutput, addOutputs, getDataResourceID, getInputParameters, getOutputParameters, getOutputs, replaceSpecialCharacters, setDataResourceID, setInput |
Methods inherited from class uk.org.ogsadai.client.toolkit.activity.RequestComponent |
getDataService, getName, getSession, setDataService, setSession |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private java.lang.String mFilename
private long mOffset
private boolean mIsBinary
private long mLength
private boolean mBase64encode
Constructor Detail |
public ReadFile()
public ReadFile(java.lang.String filename)
filename
- Relative path to file to read.public ReadFile(ActivityOutput input)
input
- Output from another activity that provides input to this
activity. This will only be used if there is no file name
(i.e. getFilename
is null
).
java.lang.IllegalArgumentException
- If input
is null
.Method Detail |
public void setFilename(java.lang.String filename)
filename
- Relative path to file to read.public java.lang.String getFilename()
public void setBinary(boolean isBinary)
getFilename
is null
).
isBinary
- true
if file is to be treated as binary and
false
otherwise.public boolean isBinary()
true
if file is to be treated as binary
and false
otherwise.public void setLength(long length)
isBinary
is true
)
or lines to be read. The value can be set to -1 to read the filed from
offset to the end of file. The value is not used if there is
no file name (i.e. getFilename
is null
).
length
- Number of bytes or lines, or -1 if reading to the end of the
file
java.lang.IllegalArgumentException
- if length
< -1.public long getLength()
isBinary
is
true
) or lines to be read.
public void setOffset(long offset)
isBinary
is
true
) or the first line to be read. The value is not used
if there is no file name (i.e. getFilename
is
null
).
offset
- Position of first byte or line, starting at 0.
java.lang.IllegalArgumentException
- if offset
< 0.public long getOffset()
isBinary
is
true
) or line to be read.
public boolean isBase64encoded()
true
if the output will be base64 encoded,
false
otherwise.public void setBase64encode(boolean base64encode)
base64encode
- true
if the output will be base64 encoded,
false
otherwise.public void setInput(ActivityOutput input)
input
- Output from another activity that provides input to this
activity. This will only be used if there is no file name
(i.e. getFilename
is null
).
java.lang.IllegalArgumentException
- If input
is null
.public ActivityOutput getOutput()
protected java.lang.String generateXML()
RequestComponent
generateXML
in class Activity
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |