ZipBlockReader

The ZipBlockReader class is used to parse a Zip archive. It exposes the contents of the archive via an iteration interface. For instance, to loop over all files in an archive, one can use either

foreach( entry ; reader )
    ...

Or

while( reader.more )
{
    auto entry = reader.get;
    ...
}

See the ZipEntry class for more information on the contents of entries.

Note that this class can only be used with input sources which can be freely seeked. Also note that you may open a ZipEntry instance produced by this reader at any time until the ZipReader that created it is closed.

Constructors

this
this(const(char)[] path)

Creates a ZipBlockReader using the specified file on the local filesystem.

this
this(InputStream source)

Creates a ZipBlockReader using the provided InputStream. Please note that this InputStream must be attached to a conduit implementing the IConduit.Seek interface.

Members

Functions

close
void close()

Closes the reader, and releases all resources. After this operation, all ZipEntry instances created by this ZipReader are invalid and should not be used.

get
ZipEntry get()
ZipEntry get(ZipEntry reuse)

Retrieves the next file from the archive. Note that although this does perform IO operations, it will not read the contents of the file.

more
bool more()

Returns true if and only if there are additional files in the archive which have not been read via the get method. This returns true before the first call to get (assuming the opened archive is non-empty), and false after the last file has been accessed.

opApply
int opApply(int delegate(ref ZipEntry) dg)

This is used to iterate over the contents of an archive using a foreach loop. Please note that the iteration will reuse the ZipEntry instance passed to your loop. If you wish to keep the instance and re-use it later, you must use the dup member to create a copy.

streamed
bool streamed()
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From ZipReader

streamed
bool streamed()
Undocumented in source.
close
void close()
Undocumented in source.
more
bool more()
Undocumented in source.
get
ZipEntry get()
Undocumented in source.
get
ZipEntry get(ZipEntry )
Undocumented in source.
opApply
int opApply(int delegate(ref ZipEntry) )
Undocumented in source.

Meta