Package de.geolykt.starloader.util

# Class JavaInterop

java.lang.Object
de.geolykt.starloader.util.JavaInterop

public final class JavaInterop extends Object

## Constructor Summary

Constructors
Constructor
Description
`JavaInterop()`

## Method Summary

Modifier and Type
Method
Description
`static final @NotNull String`
`getClassloaderName(ClassLoader loader)`
`static final @Nullable ClassLoader`
`getPlatformClassLoader()`
Obtains the platform classloader under Java 9 or above.
`static final boolean`
`isJava9()`
`static final byte @NotNull []`
`readAllBytes(@NotNull InputStream in)`

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

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

## Constructor Details

### JavaInterop

public JavaInterop()

## Method Details

### getClassloaderName

@NotNull public static final @NotNull String getClassloaderName(ClassLoader loader)

### getPlatformClassLoader

@Nullable @AvailableSince("4.0.0-a20250906") public static final @Nullable ClassLoader getPlatformClassLoader()
Obtains the platform classloader under Java 9 or above. Under Java 8, `null` is returned.

Keep in mind that while the platform classloader contains the platform classes, it has also access to modules on the modulepath. This means that when using JPMS/Jigsaw, it may load classes that are part of the 'app' classloader. This behaviour contradicts the behaviour for classes present on the classpath, which cannot be loaded through the platform classloader.

This method used to be historically available under the name "getPlattformClassloader". This however was a typo, and was corrected to the same name used by the JDK to reduce confusion. The incorrect method name was used between late March 2023 and early September 2025.

Returns:
  The platform classloader, if present.
Since:
  4.0.0-a20250906

### isJava9

public static final boolean isJava9()

### readAllBytes

public static final byte @NotNull [] readAllBytes(@NotNull @NotNull InputStream in) throws IOException

Throws:
  `IOException`