Package org.apache.tomcat.jakartaee
Class Util
- java.lang.Object
-
- org.apache.tomcat.jakartaee.Util
-
public class Util extends Object
Utility methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopy(InputStream is, OutputStream os)Buffered copy.static StringgetExtension(String filename)Get the extension of a filenamestatic StringtoString(InputStream is, Charset charset)Convert the input bytes as a string.
-
-
-
Method Detail
-
getExtension
public static String getExtension(String filename)
Get the extension of a filenameThe 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 inputos- 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 streamcharset- the charset to use- Returns:
- the converted string
- Throws:
IOException- if an exception occurs
-
-