Differences

This shows you the differences between two versions of the page.

Link to this comparison view

xpcml_util [2021/04/05 11:23] (current)
Line 1: Line 1:
 +====== XPCML Util ======
 +This little Java snippet creates a XPCML file from a PCML file.
  
 +<sxh java>
 +import java.io.File;
 +import java.io.FileInputStream;
 +import java.io.FileOutputStream;
 +import java.io.InputStream;
 +import java.io.OutputStream;
 + 
 +import com.ibm.as400.data.ProgramCallDocument;
 + 
 +public class XPCMLUtil
 +{
 +        /**
 +        * @param args
 +        */
 +        public static void main(String[] args)
 +        {
 +                if (args.length == 2)
 +                {
 +                        // check if in exists
 +                        if (new File(args[0]).exists())
 +                        {
 +                                transform(new File(args[0]), new File(args[1]));
 +                        }
 +                }
 +        }
 + 
 +        private static void transform(File in, File out)
 +        {
 +                try
 +                {
 +                        InputStream pcmlStream = new FileInputStream(in);
 +                        OutputStream xpcmlStream = new FileOutputStream(out);
 +                        ProgramCallDocument.transformPCMLToXPCML(pcmlStream, xpcmlStream);
 +                }
 +                catch (Exception e)
 +                {
 +                        System.err.println("Error:  - " + e.getMessage());
 +                        e.printStackTrace();
 +                }
 +        }
 +}
 +</sxh>
 +
 +{{tag>devel java ibm xml}}