Class ProcessHelper


  • public class ProcessHelper
    extends java.lang.Object
    Acts as helper class for process the processes i.e., copy, replace and append files.
    • Constructor Summary

      Constructors 
      Constructor Description
      ProcessHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void appendFile​(java.lang.String fileContents, java.io.File toFile)
      This method is to append the given contents into a file.
      static void copyBinaryFile​(java.net.URL source, java.io.File dest)
      This method reads contents from source, and writes the contents into destination file.
      static java.util.Set<java.lang.String> getReplaceKeys​(java.lang.String str)
      This method returns a vector of all replace marker strings.
      static java.util.Set<java.lang.String> getReplaceKeys​(java.lang.String str, java.lang.String startPattern, java.lang.String endPattern)
      This method returns a vector of all replace marker strings.
      static java.lang.String getReplaceMarker​(java.lang.String macro)  
      static java.lang.String getValueAfterExpandingMacros​(java.lang.String string, java.util.Set<java.lang.String> macros, java.util.Map<java.lang.String,​java.lang.String> valueStore)  
      static java.lang.String getValueAfterExpandingMacros​(java.lang.String string, java.util.Set<java.lang.String> macros, java.util.Map<java.lang.String,​java.lang.String> valueStore, java.lang.String startPattern, java.lang.String endPattern)  
      static void mkdirs​(org.eclipse.core.resources.IProject projectHandle, org.eclipse.core.resources.IFolder parentFolder)
      This method creates the directories in the parent folder.
      static java.lang.String readFromFile​(java.net.URL source)
      This method takes a URL as parameter to read the contents, and to add into a string buffer.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProcessHelper

        public ProcessHelper()
    • Method Detail

      • appendFile

        public static void appendFile​(java.lang.String fileContents,
                                      java.io.File toFile)
                               throws java.io.IOException
        This method is to append the given contents into a file.
        Parameters:
        fileContents - contents which are appended to the file.
        toFile - a file to append contents.
        Throws:
        java.io.IOException - exception while writing contents into a file
        Since:
        4.0
      • getReplaceKeys

        public static java.util.Set<java.lang.String> getReplaceKeys​(java.lang.String str)
        This method returns a vector of all replace marker strings. (e.g., $(item), vector contains 'item' as one item) is the end pattern.
        Parameters:
        str - A given string possibly containing markers.
        Returns:
        the set of names occurring within markers
        Since:
        4.0
      • getReplaceKeys

        public static java.util.Set<java.lang.String> getReplaceKeys​(java.lang.String str,
                                                                     java.lang.String startPattern,
                                                                     java.lang.String endPattern)
        This method returns a vector of all replace marker strings. (e.g., $(item), vector contains 'item' as one item) is the end pattern.
        Parameters:
        str - A given string possibly containing markers.
        startPattern - token to start macro replacement
        endPattern - token to end macro replacement
        Returns:
        the set of names occurring within markers
        Since:
        5.5
      • readFromFile

        public static java.lang.String readFromFile​(java.net.URL source)
                                             throws java.io.IOException
        This method takes a URL as parameter to read the contents, and to add into a string buffer.
        Parameters:
        source - URL to read the contents.
        Returns:
        string contents of a file specified in the URL source path.
        Throws:
        java.io.IOException
        Since:
        4.0
      • copyBinaryFile

        public static void copyBinaryFile​(java.net.URL source,
                                          java.io.File dest)
                                   throws java.io.IOException
        This method reads contents from source, and writes the contents into destination file.
        Parameters:
        source - URL to read the contents.
        dest - destination file to write the contents.
        Throws:
        java.io.IOException
        Since:
        4.0
      • mkdirs

        public static void mkdirs​(org.eclipse.core.resources.IProject projectHandle,
                                  org.eclipse.core.resources.IFolder parentFolder)
                           throws org.eclipse.core.runtime.CoreException
        This method creates the directories in the parent folder.
        Parameters:
        projectHandle -
        parentFolder -
        Throws:
        org.eclipse.core.runtime.CoreException
        Since:
        4.0
      • getValueAfterExpandingMacros

        public static java.lang.String getValueAfterExpandingMacros​(java.lang.String string,
                                                                    java.util.Set<java.lang.String> macros,
                                                                    java.util.Map<java.lang.String,​java.lang.String> valueStore)
        Parameters:
        string -
        macros -
        valueStore -
        Returns:
        the macro value after expanding the macros.
        Since:
        4.0
      • getValueAfterExpandingMacros

        public static java.lang.String getValueAfterExpandingMacros​(java.lang.String string,
                                                                    java.util.Set<java.lang.String> macros,
                                                                    java.util.Map<java.lang.String,​java.lang.String> valueStore,
                                                                    java.lang.String startPattern,
                                                                    java.lang.String endPattern)
        Parameters:
        string -
        macros -
        valueStore -
        Returns:
        the macro value after expanding the macros.
        Since:
        5.5
      • getReplaceMarker

        public static java.lang.String getReplaceMarker​(java.lang.String macro)
        Parameters:
        macro -
        Returns:
        the replacement marker string
        Since:
        4.0