public class NitroUtils
extends java.lang.Object
| Constructor and Description |
|---|
NitroUtils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
compareDirNames(java.lang.String dir1,
java.lang.String dir2)
Compare two directory names to see if they are equivalent
|
static int |
findFileBase(java.lang.String filename)
Get the character position of the final name in a path.
|
static int |
findFileExtension(java.lang.String filename)
Get the character position of a file extension in a file name.
|
static boolean |
hasBinary(java.lang.String val)
Check whether a string contains non-ASCII data
|
static boolean |
isPattern(java.lang.String pattern)
Check whether a string contains a pattern (wildcard) value.
|
static boolean |
isValidURL(java.lang.String urlStr)
Check whether a string contains a valid URL.
|
static java.lang.String |
removeExtension(java.lang.String filename) |
static java.lang.String |
removeNumericExtension(java.lang.String filename)
Strip the Creo revision number from a file name
|
static java.lang.String |
setFileExtension(java.lang.String filename,
java.lang.String ext)
Add an extension to a file name, or replace an existing extension.
|
static java.lang.String |
transformPattern(java.lang.String pattern)
Transform a user-provided search pattern into a Java regular expression string.
|
static void |
validateDirFile(java.lang.String dirname,
java.lang.String filename,
boolean writable)
Validate that a directory and file exist.
|
static void |
validateNameChars(java.lang.String name)
Check whether a string contains any characters that would be invalid in a
Creo object name.
|
public static java.lang.String setFileExtension(java.lang.String filename,
java.lang.String ext)
filename - The file name to modifyext - The extension to add or update. Must include the dot.public static int findFileExtension(java.lang.String filename)
filename - The file name to searchpublic static int findFileBase(java.lang.String filename)
filename - The path/file name to searchpublic static java.lang.String removeExtension(java.lang.String filename)
public static java.lang.String removeNumericExtension(java.lang.String filename)
filename - The file name to updatepublic static void validateDirFile(java.lang.String dirname,
java.lang.String filename,
boolean writable)
throws JLIException
dirname - The directory name to check. If null, then the application's execution directory (NOT the Creo working directory) is usedfilename - The file name to check.writable - Whether to check that the file is writableJLIException - The validation failedpublic static boolean compareDirNames(java.lang.String dir1,
java.lang.String dir2)
dir1 - dir2 - public static boolean isPattern(java.lang.String pattern)
pattern - The pattern to checkpublic static java.lang.String transformPattern(java.lang.String pattern)
pattern - The user filter patternpublic static boolean hasBinary(java.lang.String val)
val - The string to checkpublic static void validateNameChars(java.lang.String name)
throws JLIException
name - The name to validate.JLIException - The validation failed.public static boolean isValidURL(java.lang.String urlStr)
urlStr - The string to validate