Package-level declarations

JVM information and other useful utilities.

Classpath URLs in native images

To use the 'classpath' URL scheme on GraalVM native images, the native-image command requires to add the Classpath handler manually with the --enable-url-protocols=classpath parameter.

Types

Link copied to clipboard
object Ansi

Constants for console formatting with ANSI codes. They can be used in strings to enable or disable a display option.

Link copied to clipboard
object ClasspathHandler : URLStreamHandler
Link copied to clipboard
data class Glob(val pattern: String)
Link copied to clipboard
object Jvm

Object with utilities to gather information about the running JVM.

Link copied to clipboard
class ResourceNotFoundException(message: String) : IOException

Functions

Link copied to clipboard
fun String.decodeBase64(): ByteArray

Decode this base64 encoded string.

Link copied to clipboard
fun ByteArray.encodeToBase64(): String

Encode the content of this byteArray to base64.

fun String.encodeToBase64(): String

Encode this string to base64.

Link copied to clipboard
fun URL.exists(): Boolean
Link copied to clipboard
fun <T : Any> fieldsMapOf(vararg fields: Pair<KProperty1<T, *>, *>): Map<String, *>
Link copied to clipboard
fun <T : Any> fieldsMapOfNotNull(vararg fields: Pair<KProperty1<T, *>, *>): Map<String, *>
Link copied to clipboard
fun Throwable.filterStackTrace(prefix: String): Array<out StackTraceElement>

Return the stack trace array of the frames that starts with the given prefix.

Link copied to clipboard
fun URL.firstVariant(vararg suffixes: String): URL
Link copied to clipboard
fun freePort(): Int

Return a random free port (not used by any other local process).

Link copied to clipboard
fun inetAddress(vararg bytes: Byte): InetAddress

Syntactic sugar to create an Internet address.

Link copied to clipboard
inline operator fun <T : Any> Map<*, *>.invoke(vararg keys: Any): T?
Link copied to clipboard
fun isPortOpened(port: Int): Boolean

Check if a port is already opened.

Link copied to clipboard
inline fun <T : Any> Map<*, *>.keys(vararg keys: Any): T?
Link copied to clipboard
fun URL.localized(locale: Locale): URL
Link copied to clipboard
fun <K : Any> mapOfNotNull(vararg pairs: Pair<K, *>): Map<K, *>
Link copied to clipboard
fun <T : Any> String.parse(type: KClass<T>): T
Link copied to clipboard
fun <T : Any> String?.parseOrNull(type: KClass<T>): T?
Link copied to clipboard
fun String.prependIndent(count: Int = 4, pad: String = " "): String
Link copied to clipboard
fun <K, V> Map<K, V>.require(name: K): V
Link copied to clipboard
inline fun <T : Any> Map<*, *>.requireKeys(vararg name: Any): T
Link copied to clipboard
fun URL.responseCode(): Int
Link copied to clipboard
fun URL.responseFound(): Boolean
Link copied to clipboard
fun URL.responseSuccessful(): Boolean
Link copied to clipboard
fun String.stripAnsi(): String
Link copied to clipboard
fun String.toStream(): InputStream
Link copied to clipboard
fun Throwable.toText(prefix: String = ""): String

Return this throwable as a text.

Properties

Link copied to clipboard
val ALL_INTERFACES: InetAddress

Internet address used to bind services to all local network interfaces.

Link copied to clipboard
val assertEnabled: Boolean

This flag is true when assertions are enabled in the JVM (-ea flag). Assertions are disabled by default in the JVM, but they are enabled (and should be that way) on the tests.

Link copied to clipboard
val eol: String

Runtime specific end of line.

Link copied to clipboard
val fail: Nothing

Syntax sugar to throw errors.

Link copied to clipboard
val LOOPBACK_INTERFACE: InetAddress

Internet address used to bind services to the loopback interface.

Link copied to clipboard
val parsedClasses: Set<KClass<*>>

Supported types for the parseOrNull function.