copyFileFromJar

fun copyFileFromJar(fileToCopy: String, replaceIfExists: Boolean, classToCopyFrom: Class<*>, directory: String)

Copy a file from inside our JAR-file to the host filesystem. The file will create exactly as specified in the parameter.

Example:

  • copyFileFromJar(File("log4j2.xml")) will result in the log4j2.xml file from inside the JAR-file to be copied to the outside of the JAR-file as log4j2.xml

Author

Griefed

Parameters

fileToCopy

The source-file in the JAR you wish to copy outside the JAR.

replaceIfExists

Whether to replace the file, if it already exists.

classToCopyFrom

The class of the JAR from which you want to copy from.

directory

The directory where the file should be copied to.


fun copyFileFromJar(fileToCopy: String, identifierClass: Class<*>, directory: String): Boolean

Copy a file from inside our JAR-file to the host filesystem. The file will be created with exactly the same path specified in the parameter.

Example:

  • copyFileFromJar(File("log4j2.xml")) will result in the log4j2.xml file from inside the JAR-file to be copied to the outside of the JAR-file as log4j2.xml

Return

true if the file was created, false otherwise.

Author

Griefed

Parameters

fileToCopy

The source-file in the JAR you wish to copy outside the JAR.

identifierClass

The class of the JAR from which to get the resource.

directory

The directory to copy the file to.


fun copyFileFromJar(fileToCopy: String, destinationFile: File, replaceIfExists: Boolean, identifierClass: Class<*>)

Copy a file from inside our JAR-file to the host filesystem to the specified destination, replacing an already existing file. The file will be created with exactly the same path specified in the parameter.

Example:

  • copyFileFromJar(File("log4j2.xml")) will result in the log4j2.xml file from inside the JAR-file to be copied to the outside of the JAR-file as log4j2.xml

Author

Griefed

Parameters

fileToCopy

The source-file in the JAR you wish to copy outside the JAR.

destinationFile

The file to which to copy to.

identifierClass

The class of the JAR from which to get the resource.

replaceIfExists

Whether to replace the file, if it already exists.


fun copyFileFromJar(fileToCopy: String, destinationFile: File, identifierClass: Class<*>): Boolean

Copy a file from inside our JAR-file to the host filesystem to the specified destination. The file will be created with exactly the same path specified in the parameter.

Example:

  • copyFileFromJar(File("log4j2.xml")) will result in the log4j2.xml file from inside the JAR-file to be copied to the outside of the JAR-file as log4j2.xml

Return

true if the file was created, false otherwise.

Author

Griefed

Parameters

fileToCopy

The source-file in the JAR you wish to copy outside the JAR.

identifierClass

The class of the JAR from which to get the resource.

destinationFile

The file to which to copy to.