Class ArchiveBuilder
- Namespace
- ZeroInstall.Archives.Builders
- Assembly
- ZeroInstall.Archives.dll
Builds implementation archive files.
public static class ArchiveBuilder
- Inheritance
-
ArchiveBuilder
- Inherited Members
Fields
SupportedMimeTypes
All supported MIME types for creating archives. This is a subset of KnownMimeTypes
public static readonly string[] SupportedMimeTypes
Field Value
- string[]
Methods
Create(Stream, string, bool)
Creates a new ArchiveBuilder for creating an archive and writing it to a stream.
[MustDisposeResource]
public static IArchiveBuilder Create(Stream stream, string mimeType, bool fast = false)
Parameters
stream
StreamThe stream to write the archive to. Will be disposed when the builder is disposed.
mimeType
stringThe MIME type of archive format to create.
fast
boolThe compression operation should complete as quickly as possible, even if the resulting file is not optimally compressed.
Returns
Exceptions
- NotSupportedException
The
mimeType
doesn't belong to a known and supported archive type.
Create(string, string, bool)
Creates a new ArchiveBuilder for creating an archive and writing it to a file.
[MustDisposeResource]
public static IArchiveBuilder Create(string path, string mimeType, bool fast = false)
Parameters
path
stringThe path of the archive file to create.
mimeType
stringThe MIME type of archive format to create.
fast
boolThe compression operation should complete as quickly as possible, even if the resulting file is not optimally compressed.
Returns
Exceptions
- NotSupportedException
The
mimeType
doesn't belong to a known and supported archive type.- IOException
Failed to create the archive file.
- UnauthorizedAccessException
Write access to the archive file was denied.
RunForDirectory(string, string, string, ITaskHandler)
Create an an archive from a directory and writes it to a file.
public static void RunForDirectory(string sourcePath, string archivePath, string mimeType, ITaskHandler handler)
Parameters
sourcePath
stringThe path of the directory to read.
archivePath
stringThe path of the archive file to create.
mimeType
stringThe MIME type of archive format to create.
handler
ITaskHandlerA callback object used when the user needs to be informed about IO tasks.
Exceptions
- NotSupportedException
The
mimeType
doesn't belong to a known and supported archive type.- IOException
Failed to read the directory or create the archive file.
- UnauthorizedAccessException
Read access to the directory or write access to the archive file was denied.