Class JavaUtils


  • public class JavaUtils
    extends Object
    Generic Java utilities.
    • Constructor Detail

      • JavaUtils

        public JavaUtils()
    • Method Detail

      • stripHTML

        public static String stripHTML​(String html)
      • times

        public static String times​(String str,
                                   int times)
      • getFileType

        public static String getFileType​(String fileName)
      • getFilename

        public static String getFilename​(String path)
      • getBasename

        public static String getBasename​(String fileName)
      • getExtension

        public static String getExtension​(String fileName)
      • stripDriveLetter

        public static String stripDriveLetter​(String path)
      • findUnusedFile

        public static File findUnusedFile​(File file)
      • readTextFile

        public static String readTextFile​(File file)
      • createTempDirectory

        public static File createTempDirectory​(String prefix)
      • readTextURL

        public static String readTextURL​(URL url)
      • encodeURIComponent

        public static String encodeURIComponent​(String uriComp)
      • decodeURIComponent

        public static String decodeURIComponent​(String uriComp)
      • isInRange

        public static boolean isInRange​(String inetAddress,
                                        String range)
        Parameters:
        inetAddress - IPv4 or IPv6 address or a machine name, e.g. "172.68.8.12"
        range - IPv4 or IPv6 address range in CIDR notation, e.g. "172.68.8.0/24"
      • networkMask

        public static BigInteger networkMask​(int maskNumber,
                                             int size)
      • cookieValue

        public static String cookieValue​(javax.servlet.http.HttpServletRequest request,
                                         String cookieName)
      • requestInfo

        public static String requestInfo​(javax.servlet.http.HttpServletRequest request)
      • responseInfo

        public static String responseInfo​(javax.ws.rs.core.Response.StatusType status)
      • requestDump

        public static String requestDump​(javax.servlet.http.HttpServletRequest request)
      • encodeSHA256

        public static String encodeSHA256​(String data)
      • random256

        public static String random256()