Question

How to show TIFF Binary Stream

I am working on a PoC and need to show contents of a TIFF file downloaded from FileNet. I need help in figuring out why the downloaded file is empty.

I have a soap connector that retrieves content stream from FileNet P8 server. This content stream is stored in a Text property on clipboard (for now in pyWorkPage) along with file name and mime type. I pass these values to parameters and retrieve them in Java code.

Below is the Java code that I am using.

String cS = tools.getParamValue("contentStream");

String cID = tools.getParamValue("caseID");

String filePath = pega.getStaticContentUtils().getServiceExportRoot();

String fN = tools.getParamValue("fileName") + "." + tools.getParamValue("mimeType");

String explicitTmpDir = tools.getSystemSettings().getFSSetting("initialization/explicittempdir", "" , true, false);

String PathDir= explicitTmpDir +"/StaticContent/global/ServiceExport/";

try {

byte[] byteArray = cS.getBytes();

java.io.File FileName = new java.io.File(PathDir+fN); // create file

java.io.FileOutputStream fileOuputStream = new java.io.FileOutputStream(FileName);

fileOuputStream.write(byteArray); // write data into file

fileOuputStream.close(); // close file

pega_rules_default.downloadFile(FileName, tools, true); // download file and delete afterwards

} catch(Exception e) {

oLog.error("TestStream exception in Java step: " + e);

}

The code doesn't throw any error or exception but opens an empty file. If I choose to save file on my local drive, it shows a 0 byte file.

And here is some debug information.

Any help will be greatly appreciated.

Comments

Keep up to date on this post and subscribe to comments