0 votes
133 views
in Process Center by (140 points)

Hi, need suggestion how to read file from shared folder in ibm bpm server. i have create script to write file in service flow but there is no sample to read file from share folder.

//Below code converts the file content string in to byte[] (byte array).

var byteValue = Packages.java.lang.String(tw.local.ContentStream.content).getBytes();

// Below code, decodes the above Base64 byte array in to use format of byte[] (byte array)

var content64 = Packages.org.apache.commons.codec.binary.Base64.decodeBase64(byteValue);

    var fileName="/opt/docs/" + tw.local.ContentStream.fileName ;

            var file = new Packages.java.io.File(fileName);

             // if file doesnt exists, then create it

            if (!file.exists()) {

                file.createNewFile();

            }

            

          //change permission to 777 for all the users

        //no option for group and others file.setExecutable(true, false);

        file.setReadable(true, false);

       file.setWritable(true, false);

            var fop = new Packages.java.io.FileOutputStream(file);

            fop.write(content64);

Thank you,
 

Please log in or register to answer this question.

Related questions

0 votes
1 answer 560 views
0 votes
1 answer 186 views
0 votes
2 answers 1.6k views
0 votes
1 answer 336 views
0 votes
1 answer 159 views
asked Jun 15, 2017 by lavanyas (320 points)
0 votes
0 answers 82 views
0 votes
1 answer 355 views
0 votes
0 answers 65 views
0 votes
1 answer 640 views
0 votes
0 answers 717 views
+1 vote
1 answer 495 views

602 questions

493 answers

91 comments

1.9k users

Dosvak IBM BPM /BAW Products, Download Evaluation
Process & Performance Tools Process & Performance Tools
Code Analyzer Code Analyzer
UI Toolkit UI Toolkit
Integration Monitoring Integration Monitoring
Welcome to BPM Tips Q&A, Community wiki/forum where you can ask questions and receive answers from other IBM BPM experts and members of the community. Users with 2000 points will automatically be promoted to expert level.
Created by Dosvak LLC
Our Youtube Channel
...