Class Util

java.lang.Object
org.apache.tomcat.jakartaee.Util

public class Util extends Object
Utility methods.
  • Method Details

    • getExtension

      public static String getExtension(String filename)
      Get the extension of a filename

      The extension is the string after the last '.' in the filename.

      Parameters:
      filename - the name of the file
      Returns:
      the extension or an empty string, if no dot is found in the filename
    • copy

      public static void copy(InputStream is, OutputStream os) throws IOException
      Buffered copy.
      Parameters:
      is - the input
      os - the output
      Throws:
      IOException - if an exception occurs
    • toString

      public static String toString(InputStream is, Charset charset) throws IOException
      Convert the input bytes as a string.
      Parameters:
      is - the input byte stream
      charset - the charset to use
      Returns:
      the converted string
      Throws:
      IOException - if an exception occurs