类 GlobalUtil


  • public class GlobalUtil
    extends java.lang.Object
    Template
    作者:
    Yaqiang Wang
    • 构造器概要

      构造器 
      构造器 说明
      GlobalUtil()  
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static java.lang.String capitalize​(java.lang.String str)
      Capitalize the first character of a string
      static java.awt.image.BufferedImage deepCopy​(java.awt.image.BufferedImage bi)
      Deep clone a BufferedIamge
      static java.lang.Object deepCopy​(java.lang.Object oldObj)
      Deep clone object
      static java.lang.String getAppPath​(java.lang.Class cls)
      Get application path by a class
      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.
      static java.util.List<java.lang.String> getClassNames​(java.lang.String jarFileName)
      Get class names in a jar file
      static java.lang.String getDefaultFontName()
      Get default font name
      static java.lang.String getDelimiter​(java.io.File file)
      Get delimiter
      static java.lang.String getDelimiter​(java.lang.String line)
      Get separator
      static java.lang.String getFileExtension​(java.lang.String filePath)
      Get file extension
      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
      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.
      static java.lang.String getPathRoot​(java.io.File aFile)
      Get root path
      static java.lang.String getPluginClassName​(java.lang.String jarFileName)
      Get the class name which implements IPlugin interface
      static java.lang.String getRelativePath​(java.lang.String fileName, java.lang.String projFile)
      Get relative path of the file using project file path
      static java.util.List<java.lang.String> getSubDirectories​(java.lang.String directory)
      Get sub directories
      static java.lang.String getVersion()
      Get software version
      static java.awt.image.BufferedImage imageToBufferedImage​(java.awt.Image image)
      Convert Image to BufferedImage
      static boolean isInterface​(java.lang.Class c, java.lang.String szInterface)
      Determine if a class implements a interface
      static java.awt.Image makeColorTransparent​(java.awt.image.BufferedImage im, java.awt.Color color)
      Make a color of a image transparent
      static java.lang.String padLeft​(java.lang.String str, int length, char ch)
      String pad left
      static java.lang.String padRight​(java.lang.String str, int length, char ch)
      String pad right
      static java.lang.String[] split​(java.lang.String line, java.lang.String separator)
      Split a string line by separator
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • GlobalUtil

        public GlobalUtil()
    • 方法详细资料

      • 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 directory
        ext - 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.IOException
        Get class names in a jar file
        参数:
        jarFileName - The jar file name
        返回:
        The class names in the jar file
        抛出:
        java.io.FileNotFoundException
        java.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 class
        szInterface - 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.IOException
        Get relative path of the file using project file path
        参数:
        fileName - File path
        projFile - 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 image
        color - 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 string
        length - Pad length
        ch - Pad char
        返回:
        Padded string
      • padRight

        public static java.lang.String padRight​(java.lang.String str,
                                                int length,
                                                char ch)
        String pad right
        参数:
        str - The string
        length - Pad length
        ch - Pad char
        返回:
        Padded string
      • deepCopy

        public static java.lang.Object deepCopy​(java.lang.Object oldObj)
                                         throws java.lang.Exception
        Deep 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.IOException
        Get delimiter
        参数:
        file - File
        返回:
        Delimiter
        抛出:
        java.io.FileNotFoundException
        java.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 line
        separator - The separator
        返回:
        Split 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