Package-level declarations

Types

Link copied to clipboard
abstract class AbstractRepo(val scheme: String, val domainName: String, val ownerType: OwnerType, val ownerName: String, val repoName: String) : ContentRoot

Base class for Git repository content roots, providing URL construction for hosted repos.

Link copied to clipboard
object ArrayUtils

Utility object providing arrayPrint and asString overloads for all primitive array types and String arrays.

Link copied to clipboard

Utility object providing extension functions for atomic types.

Link copied to clipboard
interface ContentRoot

Root abstraction for a content location, either a local directory or a remote repository.

Link copied to clipboard
interface ContentSource

Represents a readable content source, either local or remote.

Link copied to clipboard
open class FileSource(val fileName: String) : ContentSource

A ContentSource that reads content from a local file.

Link copied to clipboard
class FileSystemSource(val pathPrefix: String) : ContentRoot

A ContentRoot backed by the local file system.

Link copied to clipboard
open class GitHubFile(val repo: GitHubRepo, val branchName: String, val srcPath: String, val fileName: String) : UrlSource

A ContentSource pointing to a specific file in a GitHub repository.

Link copied to clipboard
class GitHubRepo(ownerType: OwnerType, ownerName: String, repoName: String, scheme: String = "https://", domainName: String = GITHUB) : AbstractRepo

A ContentRoot representing a GitHub repository.

Link copied to clipboard
open class GitLabFile(val repo: GitLabRepo, val branchName: String, val srcPath: String, val fileName: String) : UrlSource

A ContentSource pointing to a specific file in a GitLab repository.

Link copied to clipboard
class GitLabRepo(ownerType: OwnerType, ownerName: String, repoName: String, scheme: String = "https://", domainName: String = "gitlab.com") : AbstractRepo

A ContentRoot representing a GitLab repository.

Link copied to clipboard
data class HostInfo(val hostName: String, val ipAddress: String)

Holds the hostname and IP address of the local machine.

Link copied to clipboard
object ListUtils

Utility object for list printing operations.

Link copied to clipboard
object MiscFuncs

Miscellaneous utility functions.

Link copied to clipboard
open class MiscJavaFuncs
Link copied to clipboard

Represents the type of owner for a Git repository.

Link copied to clipboard

Utility for reading classpath resource files.

Link copied to clipboard
open class UrlSource(val source: String) : ContentSource

A ContentSource that reads content from a URL.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class Version(val version: String, val releaseDate: String, val buildTime: Long)

Runtime annotation for embedding version metadata on a class.

Properties

Link copied to clipboard

Converts this ByteArray to a lowercase hex string.

Link copied to clipboard

Lazily resolved HostInfo for the local machine. Returns "Unknown" for both fields if the hostname cannot be determined.

Link copied to clipboard

The number of decimal digits in this Int.

The number of decimal digits in this Long.

Link copied to clipboard

Returns the simple class name of this object, or "None" if unavailable (e.g., anonymous classes).

Link copied to clipboard

Converts this Throwable's stack trace to a String.

Link copied to clipboard

Converts a glob-style pattern (using * and ? wildcards) to a regex pattern string.

Link copied to clipboard

Returns the number of generic type parameters of this object's class.

Functions

Link copied to clipboard
fun LocalDateTime.abbrevDayOfWeek(): String

Returns the abbreviated day-of-week name (e.g., "Mon", "Tue").

Link copied to clipboard
fun String.asBracketed(startChar: Char = '[', endChar: Char = ']'): String

Wraps this String with startChar and endChar.

Link copied to clipboard
fun String.asRegex(ignoreCase: Boolean = false): Regex

Converts this glob-style pattern string to a Regex.

Link copied to clipboard

Capitalizes the first character of this String.

Link copied to clipboard
fun captureStdout(block: () -> Unit): String

Captures everything printed to System.out during execution of block and returns it as a String.

Link copied to clipboard

URL-decodes this String using UTF-8 encoding.

Link copied to clipboard

URL-encodes this String using UTF-8 encoding.

Link copied to clipboard

Ensures this String starts with a leading /.

Link copied to clipboard

Ensures this String starts with prefix, prepending it if absent.

Link copied to clipboard

Ensures this String ends with suffix, appending it if absent.

Link copied to clipboard

Returns the 0-based line number of the first line matching regex, or -1 if not found.

Returns the 0-based index of the first element matching regex, or -1 if not found.

Link copied to clipboard
fun getBanner(filename: String, logger: KLogger): String

Loads an ASCII art banner from a classpath resource file, trims leading/trailing blank lines, and indents each line for display.

Link copied to clipboard
fun String.isBracketed(startChar: Char = '[', endChar: Char = ']'): Boolean

Returns true if this trimmed String starts with startChar and ends with endChar.

Link copied to clipboard

Returns true if this String can be parsed as a Double.

Link copied to clipboard

Returns true if this trimmed String is wrapped in double quotes.

Link copied to clipboard

Returns true if this String can be parsed as a Float.

Link copied to clipboard

Returns true if this String can be parsed as an Int.

Link copied to clipboard
fun String.isNotBracketed(startChar: Char = '[', endChar: Char = ']'): Boolean

Returns true if this String is not bracketed by startChar and endChar.

Link copied to clipboard

Returns true if this String cannot be parsed as a Double.

Link copied to clipboard

Returns true if this trimmed String is not wrapped in double quotes.

Link copied to clipboard

Returns true if this String cannot be parsed as a Float.

Link copied to clipboard

Returns true if this String cannot be parsed as an Int.

Link copied to clipboard

Returns true if this value is not null, with a Kotlin contract that smart-casts the receiver.

Link copied to clipboard

Returns true if this String is not quoted.

Link copied to clipboard

Returns true if this trimmed String is not wrapped in single quotes.

Link copied to clipboard

Returns true if this value is null, with a Kotlin contract that smart-casts the receiver on false.

Link copied to clipboard

Returns true if this String is either single-quoted or double-quoted.

Link copied to clipboard

Returns true if this trimmed String is wrapped in single quotes.

Link copied to clipboard
fun List<String>.join(separator: CharSequence = "/"): String

Joins this list of strings into a path without leading or trailing separators.

Link copied to clipboard

Returns the 0-based line number of the last line matching regex, or -1 if not found.

Returns the 0-based index of the last element matching regex, or -1 if not found.

Link copied to clipboard

Returns the lines between the first match of start and the last match of end, exclusive.

Returns the elements between the first match of start and the last match of end, exclusive.

Link copied to clipboard
fun Int.lpad(width: Int, padChar: Char = '0'): String

Left-pads this Int to the specified width with padChar.

Link copied to clipboard

Masks username and password in a URL string, replacing them with *****.

Link copied to clipboard

Truncates this String to at most len characters.

Link copied to clipboard

Computes the MD5 hash of this String with a byte array salt.

fun String.md5(salt: String = ""): String

Computes the MD5 hash of this String with an optional string salt.

Link copied to clipboard
fun md5Of(vararg keys: Any, separator: String = "|"): String

Computes an MD5 hash of the given keys joined by separator.

Link copied to clipboard

Generates a cryptographically secure random byte array for use as a salt.

Link copied to clipboard
fun newStringSalt(len: Int = 16): String

Generates a cryptographically secure random string for use as a salt.

Link copied to clipboard

Returns null if this String is blank, otherwise returns the string itself.

Link copied to clipboard
fun String.obfuscate(freq: Int = 2): String

Obfuscates this String by replacing characters at every freq-th position with '*'.

Link copied to clipboard
inline fun <E : Throwable, T> Result<T>.onFailureOrRethrow(action: (Throwable) -> Unit): Result<T>

Like Result.onFailure, but rethrows exceptions of type E and invokes action for all others.

Link copied to clipboard

Like Result.onFailure, but rethrows CancellationException to preserve coroutine cancellation.

Link copied to clipboard
fun pathOf(vararg elems: Any): String

Joins the given elems into a /-separated path, filtering out empty elements.

Link copied to clipboard
fun String.pluralize(cnt: Int, suffix: String = "s"): String

Appends suffix to this String when cnt is not 1 (simple English pluralization).

Link copied to clipboard
fun Int.random(): Int

Returns a random Int between 0 (inclusive) and this value (exclusive).

Returns a random Long between 0 (inclusive) and this value (exclusive).

Link copied to clipboard
fun randomId(length: Int = 10, charPool: List<Char> = ('a'..'z') + ('A'..'Z') + ('0'..'9')): String

Generates a cryptographically secure random alphanumeric string.

Link copied to clipboard
infix inline fun Int.repeat(block: (Int) -> Unit)

Repeats block this many times, passing the current iteration index.

Link copied to clipboard
fun repeatWithSleep(iterations: Int, sleepTime: Duration = 1.seconds, block: (count: Int, startMillis: Long) -> Unit)

Repeatedly executes block with a sleep between each iteration.

Link copied to clipboard
fun Int.rpad(width: Int, padChar: Char = '0'): String

Right-pads this Int to the specified width with padChar.

Link copied to clipboard
inline fun <R> runCatchingCancellable(block: () -> R): Result<R>

Like runCatching, but rethrows CancellationException to preserve coroutine cancellation semantics.

Link copied to clipboard

Computes the SHA-256 hash of this String with a byte array salt.

fun String.sha256(salt: String = ""): String

Computes the SHA-256 hash of this String with an optional string salt.

Link copied to clipboard

Converts a single-quoted String to a double-quoted String, escaping inner double quotes.

Link copied to clipboard
fun sleep(sleepTime: Duration)

Suspends the current thread for the specified Duration.

Link copied to clipboard

Returns the substring between the first occurrence of begin and the last occurrence of end.

Link copied to clipboard
infix inline operator fun Int.times(action: (Int) -> Unit)

Executes action for each value from 0 until this Int value.

infix inline operator fun Long.times(action: (Long) -> Unit)

Executes action for each value from 0 until this Long value.

infix inline operator fun Short.times(action: (Short) -> Unit)

Executes action for each value from 0 until this Short value.

Link copied to clipboard

Legacy serialization method - DEPRECATED due to security vulnerabilities. Use toByteArraySecure() instead.

Link copied to clipboard

Secure serialization using Java serialization.

Link copied to clipboard
fun <T> Iterable<T>.toCsv(): String

Joins the elements of this Iterable into a comma-separated string.

Link copied to clipboard

Wraps this String in double quotes.

Link copied to clipboard
fun LocalDateTime.toFullDateString(): String

Formats this LocalDateTime as a full date string, e.g., "Mon 04/10/26 14:30:00 PST".

Link copied to clipboard

Legacy deserialization method - DEPRECATED due to security vulnerabilities. Use toObjectSecure() instead.

Link copied to clipboard
fun <T : Serializable> ByteArray.toObjectSecure(expectedClass: Class<T>, allowedClasses: Set<Class<*>> = emptySet()): T

Deserialize with type validation and security checks.

Link copied to clipboard
fun List<String>.toPath(addPrefix: Boolean = true, addTrailing: Boolean = true, separator: CharSequence = "/"): String

Joins this list of strings into a path with configurable leading and trailing separators.

Link copied to clipboard
fun List<String>.toRootPath(addTrailing: Boolean = false, separator: CharSequence = "/"): String

Joins this list of strings into a root-relative path (with a leading separator).

Link copied to clipboard

Wraps this String in single quotes.

Link copied to clipboard
fun String.trimEnds(len: Int = 1): String

Trims whitespace and removes len characters from both ends of this String.

Link copied to clipboard

Verify SHA-256 checksum and return data without checksum.

Link copied to clipboard

Add SHA-256 checksum to data for integrity verification.

Link copied to clipboard
fun String.withLineNumbers(separator: Char = ':'): String

Prepends line numbers to each line of this String.