public class GlobalUtil extends Object
| 构造器 | 说明 |
|---|---|
GlobalUtil() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
static String |
capitalize(String str) |
Capitalize the first character of a string
|
static BufferedImage |
deepCopy(BufferedImage bi) |
Deep clone a BufferedIamge
|
static Object |
deepCopy(Object oldObj) |
Deep clone object
|
static String |
getAppPath(Class cls) |
Get application path by a class
|
static List<Class> |
getClassesInPackage(String packageName) |
Given a package name, attempts to reflect to find all classes within the
package on the local file system.
|
static List<String> |
getClassNames(String jarFileName) |
Get class names in a jar file
|
static String |
getDefaultFontName() |
Get default font name
|
static String |
getDelimiter(File file) |
Get delimiter
|
static String |
getDelimiter(String line) |
Get separator
|
static String |
getFileExtension(String filePath) |
Get file extension
|
static List<String> |
getFiles(String directory,
String ext) |
Get the list of specific file types in a directory
|
static List<String> |
getFilesInPackage(String packageName) |
Given a package name, attempts to reflect to find all file names within the
package on the local file system.
|
static String |
getPathRoot(File aFile) |
Get root path
|
static String |
getPluginClassName(String jarFileName) |
Get the class name which implements IPlugin interface
|
static String |
getRelativePath(String fileName,
String projFile) |
Get relative path of the file using project file path
|
static List<String> |
getSubDirectories(String directory) |
Get sub directories
|
static String |
getVersion() |
Get software version
|
static BufferedImage |
imageToBufferedImage(Image image) |
Convert Image to BufferedImage
|
static boolean |
isInterface(Class c,
String szInterface) |
Determine if a class implements a interface
|
static Image |
makeColorTransparent(BufferedImage im,
Color color) |
Make a color of a image transparent
|
static String |
padLeft(String str,
int length,
char ch) |
String pad left
|
static String |
padRight(String str,
int length,
char ch) |
String pad right
|
static String[] |
split(String line,
String separator) |
Split a string line by separator
|
public static String getVersion()
public static String getFileExtension(String filePath)
filePath - The file pathpublic static List<String> getFiles(String directory, String ext)
directory - The directoryext - the file extensionpublic static List<String> getSubDirectories(String directory)
directory - The directorypublic static List<String> getClassNames(String jarFileName) throws FileNotFoundException, IOException
jarFileName - The jar file nameFileNotFoundExceptionIOExceptionpublic static String getPluginClassName(String jarFileName)
jarFileName - The jar file namepublic static List<Class> getClassesInPackage(String packageName)
packageName - public static List<String> getFilesInPackage(String packageName)
packageName - public static boolean isInterface(Class c, String szInterface)
c - The classszInterface - The interface namepublic static String getPathRoot(File aFile)
aFile - The filepublic static String getRelativePath(String fileName, String projFile) throws IOException
fileName - File pathprojFile - Project file pathIOExceptionpublic static BufferedImage imageToBufferedImage(Image image)
image - The Imagepublic static Image makeColorTransparent(BufferedImage im, Color color)
im - The imagecolor - The colorpublic static String getAppPath(Class cls)
cls - Classpublic static String padLeft(String str, int length, char ch)
str - The stringlength - Pad lengthch - Pad charpublic static String padRight(String str, int length, char ch)
str - The stringlength - Pad lengthch - Pad charpublic static Object deepCopy(Object oldObj) throws Exception
oldObj - Old objectExceptionpublic static BufferedImage deepCopy(BufferedImage bi)
bi - Original imagepublic static String getDefaultFontName()
public static String getDelimiter(String line)
line - The string linepublic static String getDelimiter(File file) throws FileNotFoundException, IOException
file - FileFileNotFoundExceptionIOExceptionpublic static String[] split(String line, String separator)
line - The string lineseparator - The separatorCopyright © 2019. All rights reserved.