Class UtilsKt
-
- All Implemented Interfaces:
public final class UtilsKt
-
-
Field Summary
Fields Modifier and Type Field Description private final static <Error class: unknown class>PATH_STRING_COMPARATORprivate final static <Error class: unknown class>VCS_DIRECTORIES
-
Method Summary
Modifier and Type Method Description final <Error class: unknown class>getPATH_STRING_COMPARATOR()A comparator that sorts parent paths before child paths. final <Error class: unknown class>getVCS_DIRECTORIES()A set of directories used by version control systems to store metadata. final static ByteArraycalculateHash(File file, MessageDigest digest)Calculate the digest on the data from the given file. final static ByteArraycalculateHash(String string, MessageDigest digest)Calculate the digest on the data from the given string. final static ByteArraycalculateHash(InputStream inputStream, MessageDigest digest)Calculate the digest on the data from the given inputStream. final static <T extends Enum<T>> EnumSet<T>enumSetOf(T elems)A Kotlin-style convenience function to replace EnumSet.of() and EnumSet.noneOf(). final static List<String>getAllAncestorDirectories(String file)Return recursively all ancestor directories of the given absolute file, ordered along the path from the parent of file to the root. final static FilegetCommonParentFile(Collection<File> files)Return the longest parent file that all files have in common, or a File with an empty path if they have no common parent file. final static <Error class: unknown class>joinNonBlank(String strings, String separator)Return the concatenated strings separated by separator whereas blank strings are omitted. final static <R extends Any> RtemporaryProperties(Pair<String, String> properties, Function0<R> block)Temporarily set the specified system properties while executing block. -
-
Method Detail
-
getPATH_STRING_COMPARATOR
final <Error class: unknown class> getPATH_STRING_COMPARATOR()
A comparator that sorts parent paths before child paths.
-
getVCS_DIRECTORIES
final <Error class: unknown class> getVCS_DIRECTORIES()
A set of directories used by version control systems to store metadata. The list covers also version control systems not supported by ORT, because such directories should never be considered.
-
calculateHash
final static ByteArray calculateHash(File file, MessageDigest digest)
Calculate the digest on the data from the given file.
-
calculateHash
final static ByteArray calculateHash(String string, MessageDigest digest)
Calculate the digest on the data from the given string.
-
calculateHash
final static ByteArray calculateHash(InputStream inputStream, MessageDigest digest)
Calculate the digest on the data from the given inputStream. The caller is responsible for closing the stream.
-
enumSetOf
final static <T extends Enum<T>> EnumSet<T> enumSetOf(T elems)
A Kotlin-style convenience function to replace EnumSet.of() and EnumSet.noneOf().
-
getAllAncestorDirectories
final static List<String> getAllAncestorDirectories(String file)
Return recursively all ancestor directories of the given absolute file, ordered along the path from the parent of file to the root.
-
getCommonParentFile
final static File getCommonParentFile(Collection<File> files)
Return the longest parent file that all files have in common, or a File with an empty path if they have no common parent file.
-
joinNonBlank
final static <Error class: unknown class> joinNonBlank(String strings, String separator)
Return the concatenated strings separated by separator whereas blank strings are omitted.
-
temporaryProperties
final static <R extends Any> R temporaryProperties(Pair<String, String> properties, Function0<R> block)
Temporarily set the specified system properties while executing block. Afterwards, previously set properties have their original values restored and previously unset properties are cleared.
-
-
-
-