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.

Types

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

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

Thrown when access to a JAR-file errored.

Link copied to clipboard
class JarInformation(clazz: Class<*>)

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

Link copied to clipboard

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
class JsonUtilities(val 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

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

Link copied to clipboard
class Utilities

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

Link copied to clipboard
class WebUtilities(apiProperties: ApiProperties)

Utility-class revolving around interactions with web-resources.

Link copied to clipboard
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
fun File.create(createFileOrDir: Boolean = false, asDirectory: Boolean = false)

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

Link copied to clipboard

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
fun File.filteredWalk(filters: List<String>, filterType: FilterType = FilterType.CONTAINS, direction: FileWalkDirection = 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): String

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

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

Link copied to clipboard
inline fun <A, B> List<A>.parallelMap(context: CoroutineContext = 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: Regex, replaceWith: String): String

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

Link copied to clipboard

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

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

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.