For Excel, XML, delimited, or fixed-width files, there is a File Read node to read files in both Process Designer and Microflow. But it does not support images or files and documents in other formats. So, if your application needs to read a file or write a file in the other formats, in Process Designer or Microflow, you can use Java Task to access the file.
The configuration for the Java node is as follows.
Read File You have to write the java code to read the file and convert the byte[] of the file to a string. Define the return value of the function as a string. Now you have to export it as a jar file and upload that jar file to Process Designer or Microflow. Do the mapping of the return value of the function to Process Designer or Microflow also. The sample code is given below.
Java:
Mapping Parameter:
Write File You have to write the java code to write the file. Define the argument value of the function as a string to receive the file and convert that string to byte[], later you can write the byte[] of the file to the path on the server. Now export the jar file and upload that jar file to Process Designer or Microflow. And then do the mapping to pass the argument to the function. The Sample code is given below.
Java:
Mapping Parameter:
Image Files Once the image is encoded to Base64 format, ONEWEB can handle it exactly the same way it does a String. As a result, you can save images to data as well as read images from the database by encoding them to base64 format. To read the image as a base64 encoded string, please refer to the sample below:
Mapping Parameter: