Class StringUtils

    • Field Detail

      • ENCODING_CHARSET

        public static final Charset ENCODING_CHARSET
        Default charset to use for encoding/decoding strings.
    • Method Detail

      • isBlank

        public static boolean isBlank​(String string)
        Is string blank (null or only whitespace)?
        Parameters:
        string - The string to check.
        Returns:
        true if string is blank, false otherwise.
      • trimToNull

        public static String trimToNull​(String string)
        Returns a trimmed version of string, or null if string is null or the trimmed version is a blank string.
        Parameters:
        string - The string to trim.
        Returns:
        A trimmed version of string, or null if string is null or the trimmed version is a blank string.
      • trimToEmpty

        public static String trimToEmpty​(String string)
        Returns a trimmed version of string, or an empty string if string is null or the trimmed version is a blank string.
        Parameters:
        string - The string to trim.
        Returns:
        A trimmed version of string, or an empty string if string is null or the trimmed version is a blank string.
      • fromInputStream

        public static String fromInputStream​(InputStream inputStream)
                                      throws IOException
        Builds and returns a string representation of the given inputStream .
        Parameters:
        inputStream - The stream from which a string representation is built.
        Returns:
        A string representation of the given inputStream.
        Throws:
        IOException - If an error occurs while processing the inputStream.
      • toInteger

        public static Integer toInteger​(String string)
        Returns an Integer representation of the given string, or null if it's not a valid Integer.
        Parameters:
        string - The string to process.
        Returns:
        The Integer representation of string, or null if string is null or not a valid Integer.