AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::acsdkAssets::common::ArchiveWrapper Class Reference

#include <ArchiveWrapper.h>

Public Member Functions

virtual ~ArchiveWrapper ()=default
 
size_t sizeOfArchive (const std::string &fileName)
 
bool unpack (const std::string &fileName, const std::string &destFolder, alexaClientSDK::avsCommon::utils::filesystem::Permissions directoryPermission=alexaClientSDK::avsCommon::utils::filesystem::DEFAULT_DIRECTORY_PERMISSIONS, alexaClientSDK::avsCommon::utils::filesystem::Permissions filePermission=alexaClientSDK::avsCommon::utils::filesystem::DEFAULT_FILE_PERMISSIONS)
 
bool unpack (struct archive *reader, struct archive *writer, const std::string &destFolder, alexaClientSDK::avsCommon::utils::filesystem::Permissions directoryPermission=alexaClientSDK::avsCommon::utils::filesystem::DEFAULT_DIRECTORY_PERMISSIONS, alexaClientSDK::avsCommon::utils::filesystem::Permissions filePermission=alexaClientSDK::avsCommon::utils::filesystem::DEFAULT_FILE_PERMISSIONS)
 

Static Public Member Functions

static std::shared_ptr< ArchiveWrappergetInstance ()
 

Detailed Description

Wraps the libarchive library as libarchive is not thread-safe. One one libarchive operation could happen at a given time.

Constructor & Destructor Documentation

◆ ~ArchiveWrapper()

virtual alexaClientSDK::acsdkAssets::common::ArchiveWrapper::~ArchiveWrapper ( )
virtualdefault

Member Function Documentation

◆ getInstance()

static std::shared_ptr<ArchiveWrapper> alexaClientSDK::acsdkAssets::common::ArchiveWrapper::getInstance ( )
static

Return an instance of this class. There should be only one instance of this class.

Returns
an instance of this class, create one if it did not exist.

◆ sizeOfArchive()

size_t alexaClientSDK::acsdkAssets::common::ArchiveWrapper::sizeOfArchive ( const std::string &  fileName)

Get the total size of the contents of an archive when uncompressed. NOT the size of the archive on disk.

Parameters
fileNameof the archive to get the size of.
Returns
size of the given archive, or SIZE_MAX if an error occurs.

◆ unpack() [1/2]

bool alexaClientSDK::acsdkAssets::common::ArchiveWrapper::unpack ( const std::string &  fileName,
const std::string &  destFolder,
alexaClientSDK::avsCommon::utils::filesystem::Permissions  directoryPermission = alexaClientSDK::avsCommon::utils::filesystem::DEFAULT_DIRECTORY_PERMISSIONS,
alexaClientSDK::avsCommon::utils::filesystem::Permissions  filePermission = alexaClientSDK::avsCommon::utils::filesystem::DEFAULT_FILE_PERMISSIONS 
)

Uncompresses a given tar.gz or zip or other compression formats supported by libarchive into the destination folder

Parameters
fileNamename of compressed file
destFolderdirectory to place on. Must end in /
directoryPermissionOPTIONAL, permissions to use for the unpacked directories
filePermissionOPTIONAL, permissions to use for the unpacked files

◆ unpack() [2/2]

bool alexaClientSDK::acsdkAssets::common::ArchiveWrapper::unpack ( struct archive *  reader,
struct archive *  writer,
const std::string &  destFolder,
alexaClientSDK::avsCommon::utils::filesystem::Permissions  directoryPermission = alexaClientSDK::avsCommon::utils::filesystem::DEFAULT_DIRECTORY_PERMISSIONS,
alexaClientSDK::avsCommon::utils::filesystem::Permissions  filePermission = alexaClientSDK::avsCommon::utils::filesystem::DEFAULT_FILE_PERMISSIONS 
)

Uncompresses a given tar.gz or zip or other compression formats supported by libarchive into the destination folder

Parameters
readArchivearchive object that read archived data
writeArchivearchive object that write unpacked data
destFolderdirectory to place unpacked data in. Must not end in /
directoryPermissionOPTIONAL, permissions to use for the unpacked directories
filePermissionOPTIONAL, permissions to use for the unpacked files

The documentation for this class was generated from the following file:

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0