ErrorOr |
data class ErrorOr<out A>
Representation of an operation that may have thrown an error. |
ThreadBox |
class ThreadBox<out T>
A threadbox is a simple utility that makes it harder to forget to take a lock before accessing some shared state. Simply define a private class to hold the data that must be grouped under the same lock, and then pass the only instance to the ThreadBox constructor. You can now use the locked method with a lambda to take the lock in a way that ensures it'll be released if there's an exception. |
TransientProperty |
class TransientProperty<out T>
A simple wrapper that enables the use of Kotlin's "val x by TransientProperty { ... }" syntax. Such a property will not be serialized to disk, and if it's missing (or the first time it's accessed), the initializer will be used to set it up. Note that the initializer will be called with the TransientProperty object locked. |
RetryableException |
abstract class RetryableException : Exception
This represents a transient exception or condition that might no longer be thrown if the operation is re-run or called again. |
RunOnCallerThread |
val RunOnCallerThread: Executor |
codePointsString |
fun codePointsString(vararg codePoints: Int): String |
elapsedTime |
fun elapsedTime(block: () -> Unit): Duration |
extractZipFile |
fun extractZipFile(zipFile: Path, toDirectory: Path): Unit
Given a path to a zip file, extracts it to the given directory. |
future |
fun <T> future(block: () -> T): ListenableFuture<T> |
logElapsedTime |
fun <T> logElapsedTime(label: String, logger: Logger? = null, body: () -> T): T |
random63BitValue |
fun random63BitValue(): Long
Returns a random positive long generated using a secure RNG. This function sacrifies a bit of entropy in order to avoid potential bugs where the value is used in a context where negative numbers are not expected. |