Class ProcessHelper
- java.lang.Object
-
- org.eclipse.cdt.core.templateengine.process.ProcessHelper
-
public class ProcessHelper extends java.lang.ObjectActs as helper class for process the processes i.e., copy, replace and append files.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONDITIONstatic java.lang.StringEND_PATTERNstatic java.lang.StringEQUALSstatic java.lang.StringNOT_EQUALSstatic java.lang.StringSTART_PATTERN
-
Constructor Summary
Constructors Constructor Description ProcessHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidappendFile(java.lang.String fileContents, java.io.File toFile)This method is to append the given contents into a file.static voidcopyBinaryFile(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.StringgetReplaceMarker(java.lang.String macro)static java.lang.StringgetValueAfterExpandingMacros(java.lang.String string, java.util.Set<java.lang.String> macros, java.util.Map<java.lang.String,java.lang.String> valueStore)static java.lang.StringgetValueAfterExpandingMacros(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 voidmkdirs(org.eclipse.core.resources.IProject projectHandle, org.eclipse.core.resources.IFolder parentFolder)This method creates the directories in the parent folder.static java.lang.StringreadFromFile(java.net.URL source)This method takes a URL as parameter to read the contents, and to add into a string buffer.
-
-
-
Field Detail
-
CONDITION
public static final java.lang.String CONDITION
- See Also:
- Constant Field Values
-
START_PATTERN
public static final java.lang.String START_PATTERN
- See Also:
- Constant Field Values
-
END_PATTERN
public static final java.lang.String END_PATTERN
- See Also:
- Constant Field Values
-
EQUALS
public static final java.lang.String EQUALS
- See Also:
- Constant Field Values
-
NOT_EQUALS
public static final java.lang.String NOT_EQUALS
- See Also:
- Constant Field Values
-
-
Method Detail
-
appendFile
public static void appendFile(java.lang.String fileContents, java.io.File toFile) throws java.io.IOExceptionThis 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 replacementendPattern- 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.IOExceptionThis 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.IOExceptionThis 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.CoreExceptionThis 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
-
-