Class ProcessHelper

java.lang.Object
org.eclipse.cdt.core.templateengine.process.ProcessHelper

public class ProcessHelper extends Object
Acts as helper class for process the processes i.e., copy, replace and append files.
  • Field Details

  • Constructor Details

    • ProcessHelper

      public ProcessHelper()
  • Method Details

    • appendFile

      public static void appendFile(String fileContents, File toFile) throws 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:
      IOException - exception while writing contents into a file
      Since:
      4.0
    • getReplaceKeys

      public static Set<String> getReplaceKeys(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 Set<String> getReplaceKeys(String str, String startPattern, 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 String readFromFile(URL source) throws 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:
      IOException
      Since:
      4.0
    • copyBinaryFile

      public static void copyBinaryFile(URL source, File dest) throws 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:
      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 String getValueAfterExpandingMacros(String string, Set<String> macros, Map<String,String> valueStore)
      Parameters:
      string -
      macros -
      valueStore -
      Returns:
      the macro value after expanding the macros.
      Since:
      4.0
    • getValueAfterExpandingMacros

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

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