Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ZipArchive.AddByteArray(String, Byte[]) Method

Creates a zip item from a byte array and adds it to archive.

Namespace: DevExpress.Compression

Assembly: DevExpress.Docs.v24.2.dll

NuGet Package: DevExpress.Document.Processor

#Declaration

public ZipByteArrayItem AddByteArray(
    string name,
    byte[] content
)

#Parameters

Name Type Description
name String

A string that is the name of the zip item.

content Byte[]

A Byte[] array to compress and store in a zip item.

#Returns

Type Description
ZipByteArrayItem

A ZipByteArrayItem object that is the compressed array of bytes in an archive.

#Remarks

This code snippet adds a byte array to an archive as an item with the name “myByteArray” and outputs zipped data to the stream.

View Example

using DevExpress.Compression;

public void ArchiveByteArray() {
    byte[] myByteArray = Enumerable.Repeat((byte)0x78, 10000).ToArray();
    using (Stream myZippedStream = new FileStream("ArchiveByteArray.zip", FileMode.Create)) {
        using (ZipArchive archive = new ZipArchive()) {
            archive.AddByteArray("myByteArray", myByteArray);
            archive.Save(myZippedStream);
        }
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the AddByteArray(String, Byte[]) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also