Example usage for org.springframework.boot.loader.tools LaunchScript toByteArray

List of usage examples for org.springframework.boot.loader.tools LaunchScript toByteArray

Introduction

In this page you can find the example usage for org.springframework.boot.loader.tools LaunchScript toByteArray.

Prototype

byte[] toByteArray();

Source Link

Document

The content of the launch script as a byte array.

Usage

From source file:org.springframework.boot.loader.tools.JarWriter.java

/**
 * Create a new {@link JarWriter} instance.
 * @param file the file to write//from   w w  w  .j  a v a2  s .c  o  m
 * @param launchScript an optional launch script to prepend to the front of the jar
 * @throws IOException if the file cannot be opened
 * @throws FileNotFoundException if the file cannot be found
 */
public JarWriter(File file, LaunchScript launchScript) throws FileNotFoundException, IOException {
    FileOutputStream fileOutputStream = new FileOutputStream(file);
    if (launchScript != null) {
        fileOutputStream.write(launchScript.toByteArray());
        setExecutableFilePermission(file);
    }
    this.jarOutput = new JarArchiveOutputStream(fileOutputStream);
    this.jarOutput.setEncoding("UTF-8");
}