类 GlobalUtil
- java.lang.Object
-
- org.meteoinfo.common.util.GlobalUtil
-
public class GlobalUtil extends Object
Template- 作者:
- Yaqiang Wang
-
-
构造器概要
构造器 构造器 说明 GlobalUtil()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static Stringcapitalize(String str)Capitalize the first character of a stringstatic BufferedImagedeepCopy(BufferedImage bi)Deep clone a BufferedIamgestatic ObjectdeepCopy(Object oldObj)Deep clone objectstatic StringgetAppPath(Class cls)Get application path by a classstatic 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 filestatic StringgetDefaultFontName()Get default font namestatic StringgetDelimiter(File file)Get delimiterstatic StringgetDelimiter(String line)Get separatorstatic StringgetFileExtension(String filePath)Get file extensionstatic List<String>getFiles(String directory, String ext)Get the list of specific file types in a directorystatic 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 StringgetPathRoot(File aFile)Get root pathstatic StringgetPluginClassName(String jarFileName)Get the class name which implements IPlugin interfacestatic StringgetRelativePath(String fileName, String projFile)Get relative path of the file using project file pathstatic List<String>getSubDirectories(String directory)Get sub directoriesstatic StringgetVersion()Get software versionstatic BufferedImageimageToBufferedImage(Image image)Convert Image to BufferedImagestatic booleanisInterface(Class c, String szInterface)Determine if a class implements a interfacestatic ImagemakeColorTransparent(BufferedImage im, Color color)Make a color of a image transparentstatic StringpadLeft(String str, int length, char ch)String pad leftstatic StringpadRight(String str, int length, char ch)String pad rightstatic String[]split(String line, String separator)Split a string line by separator
-
-
-
方法详细资料
-
getVersion
public static String getVersion()
Get software version- 返回:
- Software version
-
getFileExtension
public static String getFileExtension(String filePath)
Get file extension- 参数:
filePath- The file path- 返回:
- File extension
-
getFiles
public static List<String> getFiles(String directory, String ext)
Get the list of specific file types in a directory- 参数:
directory- The directoryext- the file extension- 返回:
- File name list
-
getSubDirectories
public static List<String> getSubDirectories(String directory)
Get sub directories- 参数:
directory- The directory- 返回:
- Sub directories
-
getClassNames
public static List<String> getClassNames(String jarFileName) throws FileNotFoundException, IOException
Get class names in a jar file- 参数:
jarFileName- The jar file name- 返回:
- The class names in the jar file
- 抛出:
FileNotFoundExceptionIOException
-
getPluginClassName
public static String getPluginClassName(String jarFileName)
Get the class name which implements IPlugin interface- 参数:
jarFileName- The jar file name- 返回:
- The class name which implements IPlugin interface
-
getClassesInPackage
public 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.- 参数:
packageName-- 返回:
- Class list
-
getFilesInPackage
public 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.- 参数:
packageName-- 返回:
- File names
-
isInterface
public static boolean isInterface(Class c, String szInterface)
Determine if a class implements a interface- 参数:
c- The classszInterface- The interface name- 返回:
- Boolean
-
getPathRoot
public static String getPathRoot(File aFile)
Get root path- 参数:
aFile- The file- 返回:
- Root path
-
getRelativePath
public static String getRelativePath(String fileName, String projFile) throws IOException
Get relative path of the file using project file path- 参数:
fileName- File pathprojFile- Project file path- 返回:
- Relative path
- 抛出:
IOException
-
imageToBufferedImage
public static BufferedImage imageToBufferedImage(Image image)
Convert Image to BufferedImage- 参数:
image- The Image- 返回:
- The BufferedImage
-
makeColorTransparent
public static Image makeColorTransparent(BufferedImage im, Color color)
Make a color of a image transparent- 参数:
im- The imagecolor- The color- 返回:
- Result image
-
getAppPath
public static String getAppPath(Class cls)
Get application path by a class- 参数:
cls- Class- 返回:
- Application path
-
padLeft
public static String padLeft(String str, int length, char ch)
String pad left- 参数:
str- The stringlength- Pad lengthch- Pad char- 返回:
- Padded string
-
padRight
public static String padRight(String str, int length, char ch)
String pad right- 参数:
str- The stringlength- Pad lengthch- Pad char- 返回:
- Padded string
-
deepCopy
public static Object deepCopy(Object oldObj) throws Exception
Deep clone object- 参数:
oldObj- Old object- 返回:
- Cloned object
- 抛出:
Exception
-
deepCopy
public static BufferedImage deepCopy(BufferedImage bi)
Deep clone a BufferedIamge- 参数:
bi- Original image- 返回:
- Cloned image
-
getDefaultFontName
public static String getDefaultFontName()
Get default font name- 返回:
- Default font name
-
getDelimiter
public static String getDelimiter(String line)
Get separator- 参数:
line- The string line- 返回:
- Delimiter string
-
getDelimiter
public static String getDelimiter(File file) throws FileNotFoundException, IOException
Get delimiter- 参数:
file- File- 返回:
- Delimiter
- 抛出:
FileNotFoundExceptionIOException
-
split
public static String[] split(String line, String separator)
Split a string line by separator- 参数:
line- The string lineseparator- The separator- 返回:
- Split string array
-
-