Read text file - several lines
Created: 2010-10-28 16:34:56
The beanshell write the string 'hello' four times separated by a new lineto a temporary file. The filepath to the temporary file is then passed to the Read_text_file service which reads the file and outputs the string 'hello
hello
hello
hello'.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (3)
Read text file - several lines |
Read text file - several lines |
Read text file - several lines |
Descriptions (1)
The beanshell write the string 'hello' four times separated by a new lineto a temporary file. The filepath to the temporary file is then passed to the Read_text_file service which reads the file and outputs the string 'hello
hello
hello
hello'. |
Dependencies (0)
Processors (4)
Name |
Type |
Description |
Read_Text_File |
localworker |
ScriptBufferedReader getReader (String fileUrl) throws IOException {
InputStreamReader reader;
try {
reader = new FileReader(fileUrl);
}
catch (FileNotFoundException e) {
// try a real URL instead
URL url = new URL(fileUrl);
reader = new InputStreamReader (url.openStream());
}
return new BufferedReader(reader);
}
StringBuffer sb = new StringBuffer(4000);
BufferedReader in = getReader(fileurl);
String str;
String lineEnding = System.getProperty("line.separator");
while ((str = in.readLine()) != null) {
sb.append(str);
sb.append(lineEnding);
}
in.close();
filecontents = sb.toString();
|
Create_and_populate_temporary_file |
beanshell |
ScriptFile temp = File.createTempFile("taverna", "txt");
temp.deleteOnExit();
BufferedWriter writer = new BufferedWriter(new FileWriter(temp));
String newline = System.getProperty("line.separator");
for (int i = 0; i < Integer.parseInt(count); i++) {
writer.write(content + newline);
}
writer.close();
out = temp.getCanonicalPath(); |
hello |
stringconstant |
Valuehello |
four |
stringconstant |
Value4 |
Beanshells (1)
Name |
Description |
Inputs |
Outputs |
Create_and_populate_temporary_file |
|
content
count
|
out
|
Outputs (1)
Name |
Description |
file_contents |
|
Datalinks (4)
Source |
Sink |
Create_and_populate_temporary_file:out |
Read_Text_File:fileurl |
four:value |
Create_and_populate_temporary_file:count |
hello:value |
Create_and_populate_temporary_file:content |
Read_Text_File:filecontents |
file_contents |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (0)
(People/Groups)
None
Attributions (0)
(Workflows/Files)
None
Shared with Groups (1)
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment