I have a tif image that I need to map into an XML document. I am accessing the tif via ftp in binary transfer mode. I get the content and encode using pub.string:base64Encode. I map the data to the XML document.
Now I want to confirm the data was encoded properly, so I read the XML document back into IS as a string, map the base64 encoded string to pub.string:base64Decode and write the data back to a file as bytes. But I can not open the file.
I then try to read the same tif in using pub.file.getFile as a byte array encode in base64 then decode and write the file back to disk. I get the same problem.
Why is “bytes” an Object? Based on your description, it should be byte. A byte array is not an object and using ObjectOutputStream here is probably the issue.
Assuming that the input to the service is the byte array (which will be an “object” in the pipeline–but it isn’t really) then the service to write to the file can be as simple as this (omitting try/catch for clarity):
[highlight=Java]IDataCursor pipelineCursor = pipeline.getCursor();
String filename = IDataUtil.getString(pipelineCursor, “filename”);
byte bytes = (byte)IDataUtil.get(pipelineCursor, “bytes”);