Class Util


  • public class Util
    extends java.lang.Object
    Utility methods.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void copy​(java.io.InputStream is, java.io.OutputStream os)
      Buffered copy.
      static java.lang.String getExtension​(java.lang.String filename)
      Get the extension of a filename
      static java.lang.String toString​(java.io.InputStream is, java.nio.charset.Charset charset)
      Convert the input bytes as a string.
      • Methods inherited from class java.lang.Object

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

      • getExtension

        public static java.lang.String getExtension​(java.lang.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​(java.io.InputStream is,
                                java.io.OutputStream os)
                         throws java.io.IOException
        Buffered copy.
        Parameters:
        is - the input
        os - the output
        Throws:
        java.io.IOException - if an exception occurs
      • toString

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