// Path: src/main/java/com/excelsiorjet/api/platform/Host.java
// public class Host {
// 
//     private static final OS hostOS;
// 
//     static {
//         //detect Host OS
//         String osName = System.getProperty("os.name");
//         if (osName.contains("Windows")) {
//             hostOS = OS.WINDOWS;
//         } else if (osName.contains("Linux")) {
//             hostOS = OS.LINUX;
//         } else if (osName.contains("OS X")) {
//             hostOS = OS.OSX;
//         } else {
//             throw new AssertionError("Unknown OS: " + osName);
//         }
//     }
// 
//     public static boolean isWindows() {
//         return hostOS.isWindows();
//     }
// 
//     public static boolean isLinux() {
//         return hostOS.isLinux();
//     }
// 
//     public static boolean isOSX() {
//         return hostOS.isOSX();
//     }
// 
//     public static boolean isUnix() {
//         return hostOS.isUnix();
//     }
// 
//     public static String mangleExeName(String exe) {
//         return hostOS.mangleExeName(exe);
//     }
// 
//     public static OS getOS() {
//         return hostOS;
//     }
// }
// 
// Path: src/main/java/com/excelsiorjet/api/tasks/JetTaskFailureException.java
// public class JetTaskFailureException extends Exception {
// 
//     public JetTaskFailureException(String msg, Throwable throwable) {
//         super(msg, throwable);
//     }
// 
//     public JetTaskFailureException(String msg) {
//         super(msg);
//     }
// }
// 
// Path: src/main/java/com/excelsiorjet/api/log/Log.java
// public static Log logger;
// 
// Path: src/main/java/com/excelsiorjet/api/util/Txt.java
// public static String s(String id, Object... params) {
//     String str = null;
//     if (altMessages != null) {
//         str = altMessages.format(id, params);
//     }
//     if (str == null) {
//         str = messages.format(id, params);
//     }
//     if (str != null) {
//         return str;
//     } else {
//         if (log != null) {
//             log.error("JET message file broken: key = " + id);
//         } else {
//             throw new IllegalStateException("No log to issue error. JET message file broken: key = " + id);
//         }
//         return id;
//     }
// }


import com.excelsiorjet.api.platform.Host;
import com.excelsiorjet.api.tasks.JetTaskFailureException;
import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveOutputStream;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.excelsiorjet.api.log.Log.logger;
import static com.excelsiorjet.api.util.Txt.s;
        for (int i = 0; i < count; i++) {
            res.append(chars[(int) (chars.length * Math.random())]);
        }
        return res.toString();
    }

    public static void copy(InputStream in, OutputStream out) throws IOException {
        byte[] buffer = new byte[1024 * 1024];
        int len;
        while ((len = in.read(buffer)) > 0) {
            out.write(buffer, 0, len);
        }
    }

    public static void mkdir(File dir) throws JetTaskFailureException {
        if (!dir.exists() && !dir.mkdirs()) {
            if (!dir.exists()) {
                throw new JetTaskFailureException(s("JetApi.DirCreate.Error", dir.getAbsolutePath()));
            }
            logger.warn(s("JetApi.DirCreate.Warning", dir.getAbsolutePath()));
        }
    }

    @FunctionalInterface
    private interface CreateArchiveEntry {
        ArchiveEntry createEntry(String name, long size, int mode);
    }

    private static ArchiveEntry createZipEntry(String name, long size, int mode) {
        ZipArchiveEntry entry = new ZipArchiveEntry(name);
// Path: src/main/java/com/excelsiorjet/api/platform/Host.java
// public class Host {
// 
//     private static final OS hostOS;
// 
//     static {
//         //detect Host OS
//         String osName = System.getProperty("os.name");
//         if (osName.contains("Windows")) {
//             hostOS = OS.WINDOWS;
//         } else if (osName.contains("Linux")) {
//             hostOS = OS.LINUX;
//         } else if (osName.contains("OS X")) {
//             hostOS = OS.OSX;
//         } else {
//             throw new AssertionError("Unknown OS: " + osName);
//         }
//     }
// 
//     public static boolean isWindows() {
//         return hostOS.isWindows();
//     }
// 
//     public static boolean isLinux() {
//         return hostOS.isLinux();
//     }
// 
//     public static boolean isOSX() {
//         return hostOS.isOSX();
//     }
// 
//     public static boolean isUnix() {
//         return hostOS.isUnix();
//     }
// 
//     public static String mangleExeName(String exe) {
//         return hostOS.mangleExeName(exe);
//     }
// 
//     public static OS getOS() {
//         return hostOS;
//     }
// }
// 
// Path: src/main/java/com/excelsiorjet/api/tasks/JetTaskFailureException.java
// public class JetTaskFailureException extends Exception {
// 
//     public JetTaskFailureException(String msg, Throwable throwable) {
//         super(msg, throwable);
//     }
// 
//     public JetTaskFailureException(String msg) {
//         super(msg);
//     }
// }
// 
// Path: src/main/java/com/excelsiorjet/api/log/Log.java
// public static Log logger;
// 
// Path: src/main/java/com/excelsiorjet/api/util/Txt.java
// public static String s(String id, Object... params) {
//     String str = null;
//     if (altMessages != null) {
//         str = altMessages.format(id, params);
//     }
//     if (str == null) {
//         str = messages.format(id, params);
//     }
//     if (str != null) {
//         return str;
//     } else {
//         if (log != null) {
//             log.error("JET message file broken: key = " + id);
//         } else {
//             throw new IllegalStateException("No log to issue error. JET message file broken: key = " + id);
//         }
//         return id;
//     }
// }


// Path: src/main/java/com/excelsiorjet/api/util/Utils.java
import com.excelsiorjet.api.platform.Host;
import com.excelsiorjet.api.tasks.JetTaskFailureException;
import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveOutputStream;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;
import org.apache.commons.compress.compressors.gzip.GzipCompressorOutputStream;
import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import static com.excelsiorjet.api.log.Log.logger;
import static com.excelsiorjet.api.util.Txt.s;

        for (int i = 0; i < count; i++) {
            res.append(chars[(int) (chars.length * Math.random())]);
        }
        return res.toString();
    }

    public static void copy(InputStream in, OutputStream out) throws IOException {
        byte[] buffer = new byte[1024 * 1024];
        int len;
        while ((len = in.read(buffer)) > 0) {
            out.write(buffer, 0, len);
        }
    }

    public static void mkdir(File dir) throws JetTaskFailureException {
        if (!dir.exists() && !dir.mkdirs()) {
            if (!dir.exists()) {
                throw new JetTaskFailureException(s("JetApi.DirCreate.Error", dir.getAbsolutePath()));
            }
            logger.warn(s("JetApi.DirCreate.Warning", dir.getAbsolutePath()));
        }
    }

    @FunctionalInterface
    private interface CreateArchiveEntry {
        ArchiveEntry createEntry(String name, long size, int mode);
    }

    private static ArchiveEntry createZipEntry(String name, long size, int mode) {
        ZipArchiveEntry entry = new ZipArchiveEntry(name);
        if (Host.isUnix()) {