Loading...
Searching...
No Matches
juce::ZipFile::Builder Class Reference

## Detailed Description

Used to create a new zip file.

Create a ZipFile::Builder object, and call its addFile() method to add some files, then you can write it to a stream with write().

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

- juce_core/zip/juce_ZipFile.h

## Public Member Functions

| Builder ()
| Creates an empty builder object.
| ~Builder ()
| Destructor.
void | addFile (const File &fileToAdd, int compressionLevel, const String &storedPathName=String())
| Adds a file to the list of items which will be added to the archive.
void | addEntry (InputStream *streamToRead, int compressionLevel, const String &storedPathName, Time fileModificationTime)
void | addEntry (std::unique_ptr< InputStream > streamToRead, int compressionLevel, const String &storedPathName, Time fileModificationTime)
| Adds a stream to the list of items which will be added to the archive.
bool | writeToStream (OutputStream &target, double *progress) const
| Generates the zip file, writing it to the specified stream.

## Constructors and Destructors

## Builder()

juce::ZipFile::Builder::Builder | ( |  | ) |

Creates an empty builder object.

Referenced by writeToStream().

## ~Builder()

juce::ZipFile::Builder::~Builder | ( |  | ) |

Destructor.

## Member Functions

## addFile()

void juce::ZipFile::Builder::addFile | ( | const File & | fileToAdd,
|  | int | compressionLevel,
|  | const String & | storedPathName = String() )

Adds a file to the list of items which will be added to the archive.

The file isn't read immediately: the files will be read later when the writeToStream() method is called.

The compressionLevel can be between 0 (no compression), and 9 (maximum compression). If the storedPathName parameter is specified, you can customise the partial pathname that will be stored for this file.

## addEntry() [1/2]

void juce::ZipFile::Builder::addEntry | ( | InputStream * | streamToRead,
|  | int | compressionLevel,
|  | const String & | storedPathName,
|  | Time | fileModificationTime )

Deprecated

## addEntry() [2/2]

void juce::ZipFile::Builder::addEntry | ( | std::unique_ptr< InputStream > | streamToRead,
|  | int | compressionLevel,
|  | const String & | storedPathName,
|  | Time | fileModificationTime )

Adds a stream to the list of items which will be added to the archive.

Parameters

  streamToRead | this stream isn't read immediately - a pointer to the stream is stored, then used later when the writeToStream() method is called, and deleted by the Builder object when no longer needed, so be very careful about its lifetime and the lifetime of any objects on which it depends! This must not be null.
  compressionLevel | this can be between 0 (no compression), and 9 (maximum compression).
  storedPathName | the partial pathname that will be stored for this file
  fileModificationTime | the timestamp that will be stored as the last modification time of this entry

## writeToStream()

bool juce::ZipFile::Builder::writeToStream | ( | OutputStream & | target,
|  | double * | progress ) const

Generates the zip file, writing it to the specified stream.

If the progress parameter is non-null, it will be updated with an approximate progress status between 0 and 1.0

References Builder().

### Purchase

Get JUCE

### Discover

What's New in JUCE Features

### Learn

Documentaion Tutorials Made with JUCE Resources

### Support

JUCE Forum Newsletter Archive

### About

Contact Us JUCE Legal JUCE Licensing FAQ

### Events

Audio Developer Conference
© Raw Material Software Limited