use of com.genericworkflownodes.knime.base.data.port.FileStoreURIPortObject in project GenericKnimeNodes by genericworkflownodes.
the class Image2FilePortNodeModel method writeImageFile.
private FileStoreURIPortObject writeImageFile(ImageContent content, final ExecutionContext exec) throws IOException {
FileStoreURIPortObject fsPortObject = new FileStoreURIPortObject(exec.createFileStore("Image2FilePort"));
File outFile = fsPortObject.registerFile(Image2FilePortNodeModel.class.getSimpleName() + "." + IMAGE_FILE_EXTENSION);
logger.debug("Created output file " + outFile.getAbsolutePath());
final FileOutputStream out = new FileOutputStream(outFile);
try {
content.save(out);
} finally {
out.close();
}
return fsPortObject;
}
use of com.genericworkflownodes.knime.base.data.port.FileStoreURIPortObject in project GenericKnimeNodes by genericworkflownodes.
the class ManglerNodeModel method execute.
/**
* {@inheritDoc}
*/
@Override
protected PortObject[] execute(final PortObject[] inData, final ExecutionContext exec) throws Exception {
// translate portobject to table
BufferedDataTable table = (BufferedDataTable) inData[0];
// create a file where we can write to
FileStoreURIPortObject fsupo;
fsupo = new FileStoreURIPortObject(exec.createFileStore("ManglerNodeModel"));
// File file = fileStash.getFile(demangler.getMIMEType(), "mime");
File file = fsupo.registerFile("mangled_file." + demangler.getMIMEType());
// translate the filename to a URIContent
URIContent outputURI = new URIContent(file.toURI(), demangler.getMIMEType());
// write file
demangler.mangle(table, outputURI.getURI());
// create list
List<URIContent> uriList = new ArrayList<URIContent>();
uriList.add(outputURI);
return new FileStoreURIPortObject[] { fsupo };
}
Aggregations