Package com.sudicode.fb2gh.common
Class FB2GHUtils
- java.lang.Object
-
- com.sudicode.fb2gh.common.FB2GHUtils
-
public final class FB2GHUtils extends Object
Static utility methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
containsIgnoreCase(Collection<String> strings, String searchString)
Case-insensitive search for a string in a collection of strings.static File
createTempFile(String filename)
Create a temporary file, which will be deleted on exit.static File
createTempZipFile(File file)
Compress a single file in ZIP format.static void
nop()
Perform no operation.static void
sleepQuietly(long millis)
A "quiet" version ofThread.sleep(long)
which, rather than throwingInterruptedException
, simply restores theinterrupted
status if interrupted.
-
-
-
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 stringssearchString
- The string to search for- Returns:
true
ifsearchString
is found instrings
, regardless of case
-
createTempFile
public static File createTempFile(String filename) throws IOException
Create a temporary file, which will be deleted on exit. UnlikeFile.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, anIOException
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 ofThread.sleep(long)
which, rather than throwingInterruptedException
, simply restores theinterrupted
status if interrupted. Also silently ignores invalidmillis
values which would normally throwIllegalArgumentException
.- 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.
-
-