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