Package-level declarations

Common utilities used by various parts, projects, things, cheeseburgers. Mostly composed of smaller methods which are meant to do one and one thing only. Ya know, utilities.

Common utilities used by various parts, projects, things, cheeseburgers. Mostly composed of smaller methods which are meant to do one and one thing only. Ya know, utilities.

Types

Link copied to clipboard
fun interface Affirm<T>

Bare-bones Kotlin version of Java's predicate-system.

Link copied to clipboard

Utility-class revolving around Booleans.

Link copied to clipboard
Link copied to clipboard

File-type to use, identify and report configured Java versions with.

Link copied to clipboard
expect class FileUtilities

Utility-class revolving around various file-interactions.

actual class FileUtilities

Utility-class revolving around various file-interactions.

Link copied to clipboard

Filter-types by which to filter entries when walking through the files in a directory.

Link copied to clipboard

Exceptions thrown if a specified de.griefed.serverpackcreator.api.utilities.common.FileType is considered invalid.

Link copied to clipboard

Exceptions thrown if a specified de.griefed.serverpackcreator.api.utilities.common.FileType is considered invalid.

Link copied to clipboard
class JarAccessException(message: String?)

Thrown when access to a JAR-file errored.

Link copied to clipboard
class JarInformation(clazz: Class<*>, jarUtilities: JarUtilities = JarUtilities())

Stores values gathered by JarUtilities.jarInformation for easy access. Values stored and provided by this class are:

Link copied to clipboard
expect class JarUtilities

Some utilities used across ServerPackCreator, revolving around interacting with JAR-files.

actual class JarUtilities

Some utilities used across ServerPackCreator, revolving around interacting with JAR-files.

Link copied to clipboard
class JsonException(errorMessage: String?) : Exception

Exceptions thrown if a JSON value could not successfully be parsed.

Link copied to clipboard
expect class JsonUtilities

JSON-based utility methods for acquiring and working with JSON from files and objects.

actual class JsonUtilities(objectMapper: ObjectMapper = ObjectMapper() .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) .enable(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature()))

JSON-based utility methods for acquiring and working with JSON from files and objects.

Link copied to clipboard

Utility-class revolving around Lists.

Link copied to clipboard

Utility-class to compare to versions of semantic-format against each other and determine whether one is newer than the other.

Link copied to clipboard

Utility-class revolving around Strings.

Link copied to clipboard
expect class SystemUtilities

Utility-class revolving around the system we are running on.

actual class SystemUtilities

Utility-class revolving around the system we are running on.

Link copied to clipboard
expect class Utilities

Access to any and all utility-classes we may have.

actual class Utilities

Access to any and all utility-classes we may have.

Link copied to clipboard
expect class WebUtilities

Utility-class revolving around interactions with web-resources.

actual class WebUtilities(apiProperties: ApiProperties)

Utility-class revolving around interactions with web-resources.

Link copied to clipboard
expect class XmlUtilities

Commonly used XML utilities.

actual class XmlUtilities(documentBuilderFactory: DocumentBuilderFactory = DocumentBuilderFactory.newInstance())

Commonly used XML utilities.

Functions

Link copied to clipboard
fun <T> MutableList<T>.addMultiple(vararg entries: T)

Add multiple elements to a list in one go.

Link copied to clipboard
fun <T> concatenate(vararg lists: List<T>): List<T>
Link copied to clipboard
expect fun File.createDirectories(create: Boolean = false, directory: Boolean = false)

All parent directories are created, but not the file itself.

Link copied to clipboard
expect fun File.deleteQuietly(): Boolean

Try and delete this file or directory quietly. Deleting something quietly means that

Link copied to clipboard

Check whether any entry in this list ends with the given string.

Link copied to clipboard

Properly escape certain characters, so it can be safely used inside text-files, variables and scripts.

Link copied to clipboard
expect fun File.filteredWalk(filters: List<String>, filterType: FilterType = FilterType.CONTAINS, direction: <Error class: unknown class> = FileWalkDirection.TOP_DOWN, recursive: Boolean = true): MutableList<File>

Walk this directory and return all file-objects which match the specified filter-type using the passed list of filters.

Link copied to clipboard
fun String.insertCharacter(index: Int, character: Char): <Error class: unknown class>

Insert the given character at the given index.

Link copied to clipboard
fun ZipFile.isNotValidZipFile(): Boolean

Check whether this ZipFile denotes an invalid ZipFile.

Link copied to clipboard

Check the given file or directory for read- and write-permission.

Link copied to clipboard
fun List<<Error class: unknown class>>.matchAll(string: String): Boolean

match the given string against all regular expressions in this list.

Link copied to clipboard
inline fun <A, B> List<A>.parallelMap(context: <Error class: unknown class> = newSingleThreadContext("parallelMap"), crossinline function: suspend (A) -> B): List<B>

Compute all elements in the list in parallel and continue when every element was computed.

Link copied to clipboard
fun InputStream.readText(charset: Charset = Charsets.UTF_8): String

Read this input stream to a string.

Link copied to clipboard
fun String.regexReplace(regex: <Error class: unknown class>, replaceWith: String): String

Replace all matches for the given regex with replaceWith and return the resulting string.

Link copied to clipboard
expect fun File.regexWalk(filters: List<<Error class: unknown class>>, direction: <Error class: unknown class> = FileWalkDirection.TOP_DOWN): MutableList<File>

Walk this directory and return all file-objects which match any of the regular expressions in the provided list.

Link copied to clipboard

Remove every entry in this list that fulfills the given filter. Returns true if any element was removed.

Link copied to clipboard
fun String.replaceCharacter(index: Int, character: Char): String

Replace the character at the given index with the given new character.

Link copied to clipboard
expect fun File.size(): Double

Acquire the size of this file or directory in bytes. If this file-object denotes a directory, then the size of all files in the directory will be checked and the sum of them returned.

Link copied to clipboard
fun <T : Any> Class<T>.source(tempDir: File = File(tmpDir)): File

Acquire the JAR-file which contains this class. If JAR-file is a nested JAR-file, meaning the class is inside a JAR-file inside another JAR-file, then said nested JAR-file will be extracted to the specified directory, or your systems temp-directory, and that file will be returned by this method.

Link copied to clipboard

Check whether any entry in this list starts with the given string.

Link copied to clipboard

Test whether files can be written to this file denoting a directory. If this file is not a directory, an IllegalArgumentException will be thrown.

Link copied to clipboard
fun InputStream.writeTextToFile(file: File, charset: Charset = Charsets.UTF_8)

Write this input stream to a text-file.