Read text file - empty file
Created: 2010-10-28 16:32:28
Last updated: 2010-10-28 16:32:29
The beanshell creates an empty temporary file. The filepath to the temporary file is then passed to the Read_text_file service which reads the file and outputs the empty string ''.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (1)
Titles (3)
Read text file - empty file |
Read text file - empty file |
Read text file - empty file |
Descriptions (1)
The beanshell creates an empty temporary file. The filepath to the temporary file is then passed to the Read_text_file service which reads the file and outputs the empty string ''. |
Dependencies (0)
Processors (4)
Name |
Type |
Description |
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(); |
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();
|
hello |
stringconstant |
Valuehello |
zero |
stringconstant |
Value0 |
Beanshells (1)
Name |
Description |
Inputs |
Outputs |
Create_and_populate_temporary_file |
|
content
count
|
out
|
Outputs (1)
Name |
Description |
file_contents |
|
Datalinks (4)
Source |
Sink |
zero:value |
Create_and_populate_temporary_file:count |
hello:value |
Create_and_populate_temporary_file:content |
Create_and_populate_temporary_file:out |
Read_Text_File:fileurl |
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