Example usage for org.apache.commons.compress.compressors CompressorStreamFactory GZIP

List of usage examples for org.apache.commons.compress.compressors CompressorStreamFactory GZIP

Introduction

In this page you can find the example usage for org.apache.commons.compress.compressors CompressorStreamFactory GZIP.

Prototype

String GZIP

To view the source code for org.apache.commons.compress.compressors CompressorStreamFactory GZIP.

Click Source Link

Document

Constant used to identify the GZIP compression algorithm.

Usage

From source file:org.deventropy.shared.utils.DirectoryArchiverUtilTest.java

private void checkTarGzArchive(final File archiveFile, final File sourceDirectory, final String pathPrefix)
        throws IOException {

    FileInputStream fin = null;//from  w w  w.java2s  .c o m
    CompressorInputStream gzIn = null;
    FileOutputStream out = null;

    final File unGzippedTar = tempFolder.newFile("archive-test-" + random.nextInt() + TAR_FILE_SUFFIX);

    try {
        fin = new FileInputStream(archiveFile);
        final BufferedInputStream in = new BufferedInputStream(fin);
        out = new FileOutputStream(unGzippedTar);
        gzIn = new CompressorStreamFactory().createCompressorInputStream(CompressorStreamFactory.GZIP, in);

        IOUtils.copy(gzIn, out);

    } catch (CompressorException e) {
        throw new IOException(e);
    } finally {
        IOUtils.closeQuietly(out);
        IOUtils.closeQuietly(gzIn);
        IOUtils.closeQuietly(fin);
    }

    checkTarArchive(unGzippedTar, sourceDirectory, pathPrefix);
}

From source file:org.eclipse.cdt.arduino.core.internal.board.ArduinoManager.java

public static void downloadAndInstall(String url, String archiveFileName, Path installPath,
        IProgressMonitor monitor) throws IOException {
    Exception error = null;//ww  w .j  ava  2s.  c o m
    for (int retries = 3; retries > 0 && !monitor.isCanceled(); --retries) {
        try {
            URL dl = new URL(url);
            Path dlDir = ArduinoPreferences.getArduinoHome().resolve("downloads"); //$NON-NLS-1$
            Files.createDirectories(dlDir);
            Path archivePath = dlDir.resolve(archiveFileName);
            URLConnection conn = dl.openConnection();
            conn.setConnectTimeout(10000);
            conn.setReadTimeout(10000);
            Files.copy(conn.getInputStream(), archivePath, StandardCopyOption.REPLACE_EXISTING);

            boolean isWin = Platform.getOS().equals(Platform.OS_WIN32);

            // extract
            ArchiveInputStream archiveIn = null;
            try {
                String compressor = null;
                String archiver = null;
                if (archiveFileName.endsWith("tar.bz2")) { //$NON-NLS-1$
                    compressor = CompressorStreamFactory.BZIP2;
                    archiver = ArchiveStreamFactory.TAR;
                } else if (archiveFileName.endsWith(".tar.gz") || archiveFileName.endsWith(".tgz")) { //$NON-NLS-1$ //$NON-NLS-2$
                    compressor = CompressorStreamFactory.GZIP;
                    archiver = ArchiveStreamFactory.TAR;
                } else if (archiveFileName.endsWith(".tar.xz")) { //$NON-NLS-1$
                    compressor = CompressorStreamFactory.XZ;
                    archiver = ArchiveStreamFactory.TAR;
                } else if (archiveFileName.endsWith(".zip")) { //$NON-NLS-1$
                    archiver = ArchiveStreamFactory.ZIP;
                }

                InputStream in = new BufferedInputStream(new FileInputStream(archivePath.toFile()));
                if (compressor != null) {
                    in = new CompressorStreamFactory().createCompressorInputStream(compressor, in);
                }
                archiveIn = new ArchiveStreamFactory().createArchiveInputStream(archiver, in);

                for (ArchiveEntry entry = archiveIn.getNextEntry(); entry != null; entry = archiveIn
                        .getNextEntry()) {
                    if (entry.isDirectory()) {
                        continue;
                    }

                    // Magic file for git tarballs
                    Path path = Paths.get(entry.getName());
                    if (path.endsWith("pax_global_header")) { //$NON-NLS-1$
                        continue;
                    }

                    // Strip the first directory of the path
                    Path entryPath;
                    switch (path.getName(0).toString()) {
                    case "i586":
                    case "i686":
                        // Cheat for Intel
                        entryPath = installPath.resolve(path);
                        break;
                    default:
                        entryPath = installPath.resolve(path.subpath(1, path.getNameCount()));
                    }

                    Files.createDirectories(entryPath.getParent());

                    if (entry instanceof TarArchiveEntry) {
                        TarArchiveEntry tarEntry = (TarArchiveEntry) entry;
                        if (tarEntry.isLink()) {
                            Path linkPath = Paths.get(tarEntry.getLinkName());
                            linkPath = installPath.resolve(linkPath.subpath(1, linkPath.getNameCount()));
                            Files.deleteIfExists(entryPath);
                            Files.createSymbolicLink(entryPath, entryPath.getParent().relativize(linkPath));
                        } else if (tarEntry.isSymbolicLink()) {
                            Path linkPath = Paths.get(tarEntry.getLinkName());
                            Files.deleteIfExists(entryPath);
                            Files.createSymbolicLink(entryPath, linkPath);
                        } else {
                            Files.copy(archiveIn, entryPath, StandardCopyOption.REPLACE_EXISTING);
                        }
                        if (!isWin && !tarEntry.isSymbolicLink()) {
                            int mode = tarEntry.getMode();
                            Files.setPosixFilePermissions(entryPath, toPerms(mode));
                        }
                    } else {
                        Files.copy(archiveIn, entryPath, StandardCopyOption.REPLACE_EXISTING);
                    }
                }
            } finally {
                if (archiveIn != null) {
                    archiveIn.close();
                }
            }
            return;
        } catch (IOException | CompressorException | ArchiveException e) {
            error = e;
            // retry
        }
    }

    // out of retries
    if (error instanceof IOException) {
        throw (IOException) error;
    } else {
        throw new IOException(error);
    }
}

From source file:org.eclipse.cdt.arduino.core.internal.board.Platform.java

public IStatus install(IProgressMonitor monitor) throws CoreException {
    try {//from   ww w.j  a va  2 s . co m
        try (CloseableHttpClient client = HttpClients.createDefault()) {
            HttpGet get = new HttpGet(url);
            try (CloseableHttpResponse response = client.execute(get)) {
                if (response.getStatusLine().getStatusCode() >= 400) {
                    return new Status(IStatus.ERROR, Activator.getId(),
                            response.getStatusLine().getReasonPhrase());
                } else {
                    HttpEntity entity = response.getEntity();
                    if (entity == null) {
                        return new Status(IStatus.ERROR, Activator.getId(), Messages.ArduinoBoardManager_1);
                    }
                    // the archive has the version number as the root
                    // directory
                    Path installPath = getInstallPath().getParent();
                    Files.createDirectories(installPath);
                    Path archivePath = installPath.resolve(archiveFileName);
                    Files.copy(entity.getContent(), archivePath, StandardCopyOption.REPLACE_EXISTING);

                    // extract
                    ArchiveInputStream archiveIn = null;
                    try {
                        String compressor = null;
                        String archiver = null;
                        if (archiveFileName.endsWith("tar.bz2")) { //$NON-NLS-1$
                            compressor = CompressorStreamFactory.BZIP2;
                            archiver = ArchiveStreamFactory.TAR;
                        } else if (archiveFileName.endsWith(".tar.gz") || archiveFileName.endsWith(".tgz")) { //$NON-NLS-1$ //$NON-NLS-2$
                            compressor = CompressorStreamFactory.GZIP;
                            archiver = ArchiveStreamFactory.TAR;
                        } else if (archiveFileName.endsWith(".tar.xz")) { //$NON-NLS-1$
                            compressor = CompressorStreamFactory.XZ;
                            archiver = ArchiveStreamFactory.TAR;
                        } else if (archiveFileName.endsWith(".zip")) { //$NON-NLS-1$
                            archiver = ArchiveStreamFactory.ZIP;
                        }

                        InputStream in = new BufferedInputStream(new FileInputStream(archivePath.toFile()));
                        if (compressor != null) {
                            in = new CompressorStreamFactory().createCompressorInputStream(compressor, in);
                        }
                        archiveIn = new ArchiveStreamFactory().createArchiveInputStream(archiver, in);

                        for (ArchiveEntry entry = archiveIn.getNextEntry(); entry != null; entry = archiveIn
                                .getNextEntry()) {
                            if (entry.isDirectory()) {
                                continue;
                            }

                            // TODO check for soft links in tar files.
                            Path entryPath = installPath.resolve(entry.getName());
                            Files.createDirectories(entryPath.getParent());
                            Files.copy(archiveIn, entryPath, StandardCopyOption.REPLACE_EXISTING);
                        }
                    } finally {
                        if (archiveIn != null) {
                            archiveIn.close();
                        }
                    }
                }
            }
        }
        return Status.OK_STATUS;
    } catch (IOException | CompressorException | ArchiveException e) {
        throw new CoreException(new Status(IStatus.ERROR, Activator.getId(), "Installing Platform", e));
    }
}

From source file:org.fabrician.maven.plugins.CompressUtils.java

public static void copyTargzToArchiveOutputStream(File targzSrc, FilenamePatternFilter filter,
        ArchiveOutputStream out, String alternateBaseDir) throws IOException {
    FileInputStream fin = null;/*  w w  w .  j a  v  a  2  s . c  o m*/
    CompressorInputStream zipIn = null;
    TarArchiveInputStream tarIn = null;
    try {
        fin = new FileInputStream(targzSrc);
        zipIn = new CompressorStreamFactory().createCompressorInputStream(CompressorStreamFactory.GZIP, fin);
        tarIn = new TarArchiveInputStream(zipIn);
        TarArchiveEntry entry = tarIn.getNextTarEntry();
        while (entry != null) {
            if (filter != null && !filter.accept(entry.getName())) {
                System.out.println("Excluding " + entry.getName());
            } else {
                out.putArchiveEntry(createArchiveEntry(entry, out, alternateBaseDir));
                IOUtils.copy(tarIn, out);
                out.closeArchiveEntry();
            }
            entry = tarIn.getNextTarEntry();
        }
    } catch (Exception e) {
        throw new IOException(e);
    } finally {
        close(zipIn);
        close(tarIn);
        close(fin);
    }
}

From source file:org.fabrician.maven.plugins.CompressUtils.java

public static boolean entryExistsInTargz(File targz, String entryName) throws IOException {
    FileInputStream fin = null;//  w  w  w.  j av a  2  s  .c  om
    CompressorInputStream zipIn = null;
    TarArchiveInputStream tarIn = null;
    boolean exists = false;
    try {
        fin = new FileInputStream(targz);
        zipIn = new CompressorStreamFactory().createCompressorInputStream(CompressorStreamFactory.GZIP, fin);
        tarIn = new TarArchiveInputStream(zipIn);

        TarArchiveEntry entry = tarIn.getNextTarEntry();
        while (entry != null) {
            if (entry.getName().equals(entryName)) {
                exists = true;
                break;
            }
            entry = tarIn.getNextTarEntry();
        }
    } catch (Exception e) {
        throw new IOException(e);
    } finally {
        close(zipIn);
        close(tarIn);
        close(fin);
    }
    return exists;
}

From source file:org.fabrician.maven.plugins.GridlibPackageMojo.java

private void createTar(File distroSourceFile, FilenamePatternFilter filter) throws MojoExecutionException {
    distroFilename.getParentFile().mkdirs();
    FileOutputStream out = null;/*w  w w  .j a va  2s.  c o  m*/
    CompressorOutputStream cout = null;
    TarArchiveOutputStream tout = null;
    try {
        out = new FileOutputStream(distroFilename);
        cout = new CompressorStreamFactory().createCompressorOutputStream(CompressorStreamFactory.GZIP, out);
        tout = new TarArchiveOutputStream(cout);
        tout.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);
        if (distroSourceFile.isDirectory()) {
            CompressUtils.copyDirToArchiveOutputStream(distroSourceFile, filter, tout,
                    distroAlternateRootDirectory);
        } else if (CompressUtils.isZip(distroSourceFile)) {
            CompressUtils.copyZipToArchiveOutputStream(distroSourceFile, filter, tout,
                    distroAlternateRootDirectory);
        } else if (CompressUtils.isTargz(distroSourceFile)) {
            CompressUtils.copyTargzToArchiveOutputStream(distroSourceFile, filter, tout,
                    distroAlternateRootDirectory);
        } else {
            throw new MojoExecutionException("Unspported source type: " + distroSource);
        }
        if (distroResources != null && !"".equals(distroResources)) {
            if (filtered) {
                CompressUtils.copyFilteredDirToArchiveOutputStream(distroResources, getFilterProperties(),
                        tout);
            } else {
                CompressUtils.copyDirToArchiveOutputStream(distroResources, tout, distroAlternateRootDirectory);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        throw new MojoExecutionException(e.getMessage());
    } finally {
        CompressUtils.close(tout);
        CompressUtils.close(cout);
        CompressUtils.close(out);
    }
}

From source file:org.github.evenjn.gzip.GZipDecoderBlueprint.java

private static InputStream decode(Hook hook, InputStream is) {
    try {//w  w w.jav a 2s .  co m
        /**
         * This never throws, it's not closeable.
         */
        CompressorStreamFactory compressorStreamFactory = new CompressorStreamFactory();

        /**
         * This may throw. The result is autocloseable.
         */
        CompressorInputStream createCompressorInputStream = compressorStreamFactory
                .createCompressorInputStream(CompressorStreamFactory.GZIP, is);

        return hook.hook(createCompressorInputStream);
    } catch (CompressorException e) {
        throw new RuntimeException(e);
    }
}

From source file:org.jboss.as.plugin.common.Files.java

private static boolean requiresExtraction(final File file) {
    final String extension = getExtension(file);
    return CompressorStreamFactory.BZIP2.equals(extension) || CompressorStreamFactory.GZIP.equals(extension)
            || CompressorStreamFactory.PACK200.equals(extension)
            || CompressorStreamFactory.XZ.equals(extension);
}

From source file:org.kaaproject.kaa.server.control.service.sdk.CppSdkGenerator.java

@Override
public FileData generateSdk(String buildVersion, List<BootstrapNodeInfo> bootstrapNodes,
        SdkProfileDto sdkProfile, String profileSchemaBody, String notificationSchemaBody,
        String configurationProtocolSchemaBody, String configurationBaseSchema, byte[] defaultConfigurationData,
        List<EventFamilyMetadata> eventFamilies, String logSchemaBody) throws Exception {

    String sdkToken = sdkProfile.getToken();
    Integer configurationSchemaVersion = sdkProfile.getConfigurationSchemaVersion();
    final Integer profileSchemaVersion = sdkProfile.getProfileSchemaVersion();
    Integer notificationSchemaVersion = sdkProfile.getNotificationSchemaVersion();
    Integer logSchemaVersion = sdkProfile.getLogSchemaVersion();
    String defaultVerifierToken = sdkProfile.getDefaultVerifierToken();

    String sdkTemplateLocation = Environment.getServerHomeDir() + "/" + CPP_SDK_DIR + "/" + CPP_SDK_PREFIX
            + buildVersion + ".tar.gz";

    LOG.debug("Lookup Java SDK template: {}", sdkTemplateLocation);

    CompressorStreamFactory csf = new CompressorStreamFactory();
    ArchiveStreamFactory asf = new ArchiveStreamFactory();

    CompressorInputStream cis = csf.createCompressorInputStream(CompressorStreamFactory.GZIP,
            new FileInputStream(sdkTemplateLocation));

    final ArchiveInputStream templateArchive = asf.createArchiveInputStream(ArchiveStreamFactory.TAR, cis);

    ByteArrayOutputStream sdkOutput = new ByteArrayOutputStream();
    CompressorOutputStream cos = csf.createCompressorOutputStream(CompressorStreamFactory.GZIP, sdkOutput);

    ArchiveOutputStream sdkFile = asf.createArchiveOutputStream(ArchiveStreamFactory.TAR, cos);

    Map<String, TarEntryData> replacementData = new HashMap<>();

    List<TarEntryData> cppSources = new ArrayList<>();

    // TODO: remove all version fields and add single sdkToken field
    // create entry for default properties
    TarArchiveEntry entry = new TarArchiveEntry(SDK_DEFAULTS_PATH);
    byte[] data = generateKaaDefaults(bootstrapNodes, sdkToken, defaultConfigurationData, defaultVerifierToken);

    entry.setSize(data.length);/*  w w  w.j  a  v a2  s . co  m*/
    TarEntryData tarEntry = new TarEntryData(entry, data);
    cppSources.add(tarEntry);

    Map<String, String> profileVars = new HashMap<>();
    profileVars.put(SDK_PROFILE_VERSION_VAR, profileSchemaVersion.toString());
    cppSources.addAll(processFeatureSchema(profileSchemaBody, PROFILE_SCHEMA_AVRO_SRC,
            PROFILE_DEFINITIONS_TEMPLATE, PROFILE_DEFINITIONS_PATH, profileVars));

    cppSources.addAll(processFeatureSchema(notificationSchemaBody, NOTIFICATION_SCHEMA_AVRO_SRC,
            NOTIFICATION_DEFINITIONS_TEMPLATE, NOTIFICATION_DEFINITIONS_PATH, null));
    cppSources.addAll(processFeatureSchema(logSchemaBody, LOG_SCHEMA_AVRO_SRC, LOG_DEFINITIONS_TEMPLATE,
            LOG_DEFINITIONS_PATH, null));
    cppSources.addAll(processFeatureSchema(configurationBaseSchema, CONFIGURATION_SCHEMA_AVRO_SRC,
            CONFIGURATION_DEFINITIONS_TEMPLATE, CONFIGURATION_DEFINITIONS_PATH, null));

    if (eventFamilies != null && !eventFamilies.isEmpty()) {
        cppSources.addAll(CppEventSourcesGenerator.generateEventSources(eventFamilies));
    }

    for (TarEntryData entryData : cppSources) {
        replacementData.put(entryData.getEntry().getName(), entryData);
    }

    ArchiveEntry archiveEntry;
    while ((archiveEntry = templateArchive.getNextEntry()) != null) {
        if (!archiveEntry.isDirectory()) {
            if (replacementData.containsKey(archiveEntry.getName())) {
                TarEntryData entryData = replacementData.remove(archiveEntry.getName());
                sdkFile.putArchiveEntry(entryData.getEntry());
                sdkFile.write(entryData.getData());
            } else {
                sdkFile.putArchiveEntry(archiveEntry);
                IOUtils.copy(templateArchive, sdkFile);
            }
        } else {
            sdkFile.putArchiveEntry(archiveEntry);
        }
        sdkFile.closeArchiveEntry();
    }

    templateArchive.close();

    for (String entryName : replacementData.keySet()) {
        TarEntryData entryData = replacementData.get(entryName);
        sdkFile.putArchiveEntry(entryData.getEntry());
        sdkFile.write(entryData.getData());
        sdkFile.closeArchiveEntry();
    }

    sdkFile.finish();
    sdkFile.close();

    String sdkFileName = CPP_SDK_PREFIX + sdkProfile.getToken() + ".tar.gz";

    byte[] sdkData = sdkOutput.toByteArray();

    FileData sdk = new FileData();
    sdk.setFileName(sdkFileName);
    sdk.setFileData(sdkData);
    return sdk;
}

From source file:org.kaaproject.kaa.server.control.service.sdk.CSdkGenerator.java

@Override
public FileData generateSdk(String buildVersion, List<BootstrapNodeInfo> bootstrapNodes,
        SdkProfileDto sdkProfile, String profileSchemaBody, String notificationSchemaBody,
        String configurationProtocolSchemaBody, String configurationBaseSchemaBody,
        byte[] defaultConfigurationData, List<EventFamilyMetadata> eventFamilies, String logSchemaBody)
        throws Exception {

    String sdkToken = sdkProfile.getToken();
    Integer profileSchemaVersion = sdkProfile.getProfileSchemaVersion();
    String defaultVerifierToken = sdkProfile.getDefaultVerifierToken();

    String sdkTemplateLocation = Environment.getServerHomeDir() + "/" + C_SDK_DIR + "/" + C_SDK_PREFIX
            + buildVersion + ".tar.gz";

    LOG.debug("Lookup C SDK template: {}", sdkTemplateLocation);

    CompressorStreamFactory csf = new CompressorStreamFactory();
    ArchiveStreamFactory asf = new ArchiveStreamFactory();

    CompressorInputStream cis = csf.createCompressorInputStream(CompressorStreamFactory.GZIP,
            new FileInputStream(sdkTemplateLocation));

    final ArchiveInputStream templateArchive = asf.createArchiveInputStream(ArchiveStreamFactory.TAR, cis);

    ByteArrayOutputStream sdkOutput = new ByteArrayOutputStream();
    CompressorOutputStream cos = csf.createCompressorOutputStream(CompressorStreamFactory.GZIP, sdkOutput);

    ArchiveOutputStream sdkFile = asf.createArchiveOutputStream(ArchiveStreamFactory.TAR, cos);

    Map<String, TarEntryData> replacementData = new HashMap<>();

    List<TarEntryData> sources = new ArrayList<>();

    if (!StringUtils.isBlank(profileSchemaBody)) {
        sources.addAll(generateProfileSources(profileSchemaBody));
    }//from  w  w w .j  a  v  a2 s .  c  om

    if (!StringUtils.isBlank(logSchemaBody)) {
        sources.addAll(generateLogSources(logSchemaBody));
    }

    if (!StringUtils.isBlank(configurationBaseSchemaBody)) {
        sources.addAll(generateConfigurationSources(configurationBaseSchemaBody));
    }

    if (!StringUtils.isBlank(notificationSchemaBody)) {
        sources.addAll(generateNotificationSources(notificationSchemaBody));
    }

    if (eventFamilies != null && !eventFamilies.isEmpty()) {
        sources.addAll(CEventSourcesGenerator.generateEventSources(eventFamilies));
    }

    for (TarEntryData entryData : sources) {
        replacementData.put(entryData.getEntry().getName(), entryData);
    }

    ArchiveEntry archiveEntry;
    while ((archiveEntry = templateArchive.getNextEntry()) != null) {
        if (!archiveEntry.isDirectory()) {
            if (archiveEntry.getName().equals(KAA_DEFAULTS_HEADER)) {
                // TODO: eliminate schema versions and substitute them for a single sdkToken
                byte[] kaaDefaultsData = generateKaaDefaults(bootstrapNodes, sdkToken, profileSchemaVersion,
                        configurationProtocolSchemaBody, defaultConfigurationData, defaultVerifierToken);

                TarArchiveEntry kaaDefaultsEntry = new TarArchiveEntry(KAA_DEFAULTS_HEADER);
                kaaDefaultsEntry.setSize(kaaDefaultsData.length);
                sdkFile.putArchiveEntry(kaaDefaultsEntry);
                sdkFile.write(kaaDefaultsData);
            } else if (archiveEntry.getName().equals(KAA_CMAKEGEN)) {
                // Ignore duplicate source names
                List<String> sourceNames = new LinkedList<>();
                for (TarEntryData sourceEntry : sources) {
                    String fileName = sourceEntry.getEntry().getName();
                    if (fileName.endsWith(C_SOURCE_SUFFIX) && !sourceNames.contains(fileName)) {
                        sourceNames.add(fileName);
                    }
                }

                VelocityContext context = new VelocityContext();
                context.put("sourceNames", sourceNames);
                String sourceData = generateSourceFromTemplate(TEMPLATE_DIR + File.separator + "CMakeGen.vm",
                        context);

                TarArchiveEntry kaaCMakeEntry = new TarArchiveEntry(KAA_CMAKEGEN);
                kaaCMakeEntry.setSize(sourceData.length());
                sdkFile.putArchiveEntry(kaaCMakeEntry);
                sdkFile.write(sourceData.getBytes());
            } else if (replacementData.containsKey(archiveEntry.getName())) {
                TarEntryData entryData = replacementData.remove(archiveEntry.getName());
                sdkFile.putArchiveEntry(entryData.getEntry());
                sdkFile.write(entryData.getData());
            } else {
                sdkFile.putArchiveEntry(archiveEntry);
                IOUtils.copy(templateArchive, sdkFile);
            }
        } else {
            sdkFile.putArchiveEntry(archiveEntry);
        }

        sdkFile.closeArchiveEntry();
    }

    templateArchive.close();

    for (String entryName : replacementData.keySet()) {
        TarEntryData entryData = replacementData.get(entryName);
        sdkFile.putArchiveEntry(entryData.getEntry());
        sdkFile.write(entryData.getData());
        sdkFile.closeArchiveEntry();
    }

    sdkFile.finish();
    sdkFile.close();

    String sdkFileName = C_SDK_PREFIX + sdkProfile.getToken() + ".tar.gz";

    FileData sdk = new FileData();
    sdk.setFileName(sdkFileName);
    sdk.setFileData(sdkOutput.toByteArray());

    return sdk;
}