Class FB2GHUtils


  • public final class FB2GHUtils
    extends Object
    Static utility methods.
    • Method Detail

      • containsIgnoreCase

        public static boolean containsIgnoreCase​(Collection<String> strings,
                                                 String searchString)
        Case-insensitive search for a string in a collection of strings.
        Parameters:
        strings - A collection of strings
        searchString - The string to search for
        Returns:
        true if searchString is found in strings, regardless of case
      • createTempFile

        public static File createTempFile​(String filename)
                                   throws IOException
        Create a temporary file, which will be deleted on exit. Unlike File.createTempFile(String, String), the name of the temp file will not be randomly generated.
        Parameters:
        filename - Name of the temporary file. If the file already exists, it will be overwritten. If it exists and is a non-empty directory, an IOException will occur.
        Returns:
        The temporary file
        Throws:
        IOException - if an I/O error occurs
      • createTempZipFile

        public static File createTempZipFile​(File file)
                                      throws IOException
        Compress a single file in ZIP format.
        Parameters:
        file - The file to compress
        Returns:
        The ZIP file, which will be deleted on exit
        Throws:
        IOException - if an I/O error occurs
      • sleepQuietly

        public static void sleepQuietly​(long millis)
        A "quiet" version of Thread.sleep(long) which, rather than throwing InterruptedException, simply restores the interrupted status if interrupted. Also silently ignores invalid millis values which would normally throw IllegalArgumentException.
        Parameters:
        millis - The length of time to sleep in milliseconds. Can be negative, in which case the call will be silently ignored.
      • nop

        public static void nop()
        Perform no operation.