com.ibm.tivoli.maximo.util

Class StringUtil

  • java.lang.Object
    • com.ibm.tivoli.maximo.util.StringUtil


  • public class StringUtil
    extends java.lang.Object
    Various String/Object utils.
    Since:
    telco inception
    • Constructor Summary

      Constructors 
      Constructor and Description
      StringUtil() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.lang.String file2String(java.io.File file)
      Convert the whole contexts of file into a string.
      static java.lang.String file2String(java.io.File file, java.lang.String enc)
      Convert the whole contexts of file into a string.
      static java.lang.String firstNonEmpty(java.lang.String[] strings)
      Returns the first non empty string in the list
      static java.lang.String getHeader(java.lang.String s, int headerLength)
      Return header part with the defined headerLength.
      static boolean isEmptyBytes(byte[] bytes) 
      static boolean isEmptyString(java.lang.String s) 
      static boolean isEmptyVarargs(java.lang.Object[] objects) 
      static java.lang.String md5sum(java.lang.String input)
      Returns the MD5 checksum for the given UTF8 string data
      static void string2File(java.lang.String data, java.io.File file)
      Write a string into a file.
      static void string2File(java.lang.String data, java.io.File file, java.lang.String enc)
      Write a string into a file.
      static java.lang.String toCurrentStackString()
      Convert the current position's stack info into a String.
      static java.lang.String toString(java.io.InputStream is)
      Convert InputStream to string using default CharSet
      static java.lang.String toString(java.lang.Throwable t)
      Convert the Throwable's all info into a String.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StringUtil

        public StringUtil()
    • Method Detail

      • isEmptyString

        public static boolean isEmptyString(java.lang.String s)
        Parameters:
        s -
        Returns:
      • isEmptyBytes

        public static boolean isEmptyBytes(byte[] bytes)
        Parameters:
        bytes -
        Returns:
      • isEmptyVarargs

        public static boolean isEmptyVarargs(java.lang.Object[] objects)
        Parameters:
        objects -
        Returns:
      • getHeader

        public static java.lang.String getHeader(java.lang.String s,
                                                 int headerLength)
        Return header part with the defined headerLength. Return the original string if the input string's length is less than the headerLength.
        Parameters:
        s -
        headerLength -
        Returns:
      • toString

        public static java.lang.String toString(java.lang.Throwable t)
        Convert the Throwable's all info into a String. Use the char set: "ISO-8859-1"
      • toCurrentStackString

        public static java.lang.String toCurrentStackString()
        Convert the current position's stack info into a String.
      • file2String

        public static java.lang.String file2String(java.io.File file)
                                            throws java.lang.Exception
        Convert the whole contexts of file into a string. Encoding style is "ISO-8859-1"
        Throws:
        java.lang.Exception
      • file2String

        public static java.lang.String file2String(java.io.File file,
                                                   java.lang.String enc)
                                            throws java.lang.Exception
        Convert the whole contexts of file into a string.
        Throws:
        java.lang.Exception
      • string2File

        public static void string2File(java.lang.String data,
                                       java.io.File file)
                                throws java.lang.Exception
        Write a string into a file. Use the char set: "ISO-8859-1"
        Throws:
        java.lang.Exception
      • string2File

        public static void string2File(java.lang.String data,
                                       java.io.File file,
                                       java.lang.String enc)
                                throws java.lang.Exception
        Write a string into a file.
        Throws:
        java.lang.Exception
      • toString

        public static java.lang.String toString(java.io.InputStream is)
                                         throws java.io.IOException
        Convert InputStream to string using default CharSet
        Parameters:
        is -
        Returns:
        Throws:
        java.io.IOException
      • md5sum

        public static java.lang.String md5sum(java.lang.String input)
        Returns the MD5 checksum for the given UTF8 string data
        Parameters:
        input -
        Returns:
      • firstNonEmpty

        public static java.lang.String firstNonEmpty(java.lang.String[] strings)
        Returns the first non empty string in the list
        Parameters:
        strings -
        Returns: