Package com.google.gwt.user.tools
Class CommandLineCreatorUtils
java.lang.Object
com.google.gwt.user.tools.CommandLineCreatorUtils
IO and template utility classes for GWT command-line tools.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FilecreateNormalFile(File parent, String fileName, boolean overwrite, boolean ignore) static FilegetDirectory(File parent, String dirName, boolean create) static FilegetDirectory(String dirPath, boolean create) static StringgetFileFromClassPath(String partialPath) Gets the contents of a file from the class path as a String.static Stringstatic void
-
Constructor Details
-
CommandLineCreatorUtils
public CommandLineCreatorUtils()
-
-
Method Details
-
createNormalFile
public static File createNormalFile(File parent, String fileName, boolean overwrite, boolean ignore) throws IOException - Parameters:
parent- Parent directoryfileName- New file nameoverwrite- Is overwriting an existing file allowed?- Returns:
- Handle to the file
- Throws:
IOException- If the file cannot be created, or if the file already existed and overwrite was false.
-
getDirectory
- Parameters:
dirPath- Requested path for the directory.create- Create the directory if it does not already exist?- Returns:
- A
Filerepresenting a directory that now exists. - Throws:
IOException- If the directory is not found and/or cannot be created.
-
getDirectory
- Parameters:
parent- Parent directory of the requested directory.dirName- Requested name for the directory.create- Create the directory if it does not already exist?- Returns:
- A
Filerepresenting a directory that now exists. - Throws:
IOException- If the directory is not found and/or cannot be created.
-
getFileFromClassPath
Gets the contents of a file from the class path as a String. Note: this method is only guaranteed to work for resources in the same class loader that contains thisCommandLineCreatorUtilsclass.- Parameters:
partialPath- the partial path to the resource on the class path- Returns:
- the contents of the file
- Throws:
IOException- if the file could not be found or an error occurred while reading it
-
getInstallPath
-
writeTemplateFile
public static void writeTemplateFile(File file, String contents, Map<String, String> replacements) throws IOException- Throws:
IOException
-