blob: a65b4485c7777c3896727623efc6defa4b519d02 [file] [log] [blame]
{
"classLoaderSharing" : "workflow",
"script" : "if ((url == void) || (url == null)) {\n\tthrow new RuntimeException(\"The url must be specified\");\n}\n\nURL inputURL = null;\nif (base != void) {\n\tinputURL = new URL(new URL(base), url);\n} else {\n\tinputURL = new URL(url);\n}\n\nint bytesRead = 0;\nint totalBytesRead = 0;\nInputStream is = inputURL.openStream();\nByteArrayOutputStream os = new ByteArrayOutputStream();\nbyte[] buffer = new byte[2048];\nwhile (true) {\n\tbytesRead = is.read(buffer);\n\tif (bytesRead == -1) {\n\t\tbreak;\t\n\t}\n\n\tos.write(buffer, 0, bytesRead);\n}\n\nimage = os.toByteArray();\nis.close();\nos.close();\n",
"localworkerName" : "org.embl.ebi.escience.scuflworkers.java.WebImageFetcher",
"inputPorts" : [ {
"name" : "url",
"depth" : 0,
"type" : "String"
}, {
"name" : "base",
"depth" : 0,
"type" : "String"
} ],
"outputPorts" : [ {
"name" : "image",
"depth" : 0,
"granularDepth" : 0
} ],
"isAltered" : false
}