Package de.geolykt.starloader.launcher

# Class Utils

java.lang.Object
de.geolykt.starloader.launcher.Utils

public final class Utils extends Object
Collection of static utility methods.

## Method Summary

Modifier and Type
Method
Description
`static final @NotNull String`
`applyPlaceholders(@NotNull Object sourceResource, @NotNull String string, int startIndex, @NotNull Map<String,String> placeholders)`
Expand placeholders as defined by `ExtensionPrototype.getDefinedProperties()`.
`static final void`
`fastExhaust(@NotNull InputStream in)`
`static final Path`
`getLogDirectory()`
Obtains the directory where SLL puts its logs.
`static final void`
`startMain(@NotNull Class<?> className, String[] args)`
`static final @Nullable URI`
`toCodeSourceURI(@Nullable URL url, @NotNull String internalClassName)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### applyPlaceholders

@NotNull @AvailableSince("4.0.0-a20240711") @Contract(pure=true) public static final @NotNull String applyPlaceholders(@NotNull @NotNull Object sourceResource, @NotNull @NotNull String string, int startIndex, @NotNull @NotNull Map<String,String> placeholders)
Expand placeholders as defined by `ExtensionPrototype.getDefinedProperties()`. This method will recursively replace placeholders.

Parameters:
  `sourceResource` - The resource from which the input string comes from, used when logging unknown keys. Logged as-is, so the `Object.toString()` method of the value passed as this argument should be human-readable.
  `string` - The input string which may contain placeholders to expand.
  `startIndex` - The index from which the expansion should start from. When calling this method directly, it usually can be set to 0 to replace the entire string.
  `placeholders` - The placeholders to apply.
Returns:
  The returned string with all relevant properties being expanded.
Since:
  4.0.0-a20240711

### fastExhaust

public static final void fastExhaust(@NotNull @NotNull InputStream in) throws IOException

Throws:
  `IOException`

### getLogDirectory

public static final Path getLogDirectory()
Obtains the directory where SLL puts its logs.

It will first try to set the log directory to the value described by XDG_STATE_HOME, then "%APPDATA%/stianloader", then "${user.home}/.local/state/stianloader" and if it still fails it will put it in the current working directory. It will however only create a single directory in order to accomplish this, so it won't always use the current working directory if less advanced users attempt to use the launcher.

Returns:
  The directory in which the logs of SLL are stored.

### startMain

public static final void startMain(@NotNull @NotNull Class<?> className, String[] args)

### toCodeSourceURI

@Nullable public static final @Nullable URI toCodeSourceURI(@Nullable @Nullable URL url, @NotNull @NotNull String internalClassName)