BSD style: see
license.txt
Initial release: July 2007
Daniel Keep
- class BzipOutput : OutputFilter ¶#
-
This output filter can be used to perform compression of data into a bzip2
stream.
- enum BlockSize ¶#
-
This enumeration represents several pre-defined compression block
sizes, measured in hundreds of kilobytes. See the documentation for
the BzipOutput class' constructor for more details.
- this(OutputStream stream, int blockSize = BlockSize.Normal) ¶#
-
Constructs a new bzip2 compression filter. You need to pass in the
stream that the compression filter will write to. If you are using
this filter with a conduit, the idiom to use is:
1
2
| auto output = new BzipOutput(myConduit.output);
output.write(myContent);
|
blockSize relates to the size of the window bzip2 uses when
compressing data and determines how much memory is required to
decompress a stream. It is measured in hundreds of kilobytes.
ccording to the bzip2 documentation, there is no dramatic difference
between the various block sizes, so the default should suffice in most
cases.
BlockSize.Normal (the default) is the same as BlockSize.Best
(or 9). The blockSize may be any integer between 1 and 9 inclusive.
- size_t write(void[] src) ¶#
-
Compresses the given data to the underlying conduit.
Returns the number of bytes from src that were compressed, which may
be less than given.
- size_t written() ¶#
-
This read-only property returns the number of compressed bytes that
have been written to the underlying stream. Following a call to
either close or commit, this will contain the total compressed size of
the input data stream.
- void close() ¶#
-
commit the output
- void commit() ¶#
-
Purge any buffered content. Calling this will implicitly end the
bzip2 stream, so it should not be called until you are finished
compressing data. Any calls to either write or commit after a
compression filter has been committed will throw an exception.
- class BzipInput : InputFilter ¶#
-
This input filter can be used to perform decompression of bzip2 streams.
- this(InputStream stream, bool small = false) ¶#
-
Constructs a new bzip2 decompression filter. You need to pass in the
stream that the decompression filter will read from. If you are using
this filter with a conduit, the idiom to use is:
1
2
| auto input = new BzipInput(myConduit.input);
input.read(myContent);
|
The small argument, if set to true, instructs bzip2 to perform
decompression using half the regular amount of memory, at the cost of
running at half speed.
- size_t read(void[] dst) ¶#
-
Decompresses data from the underlying conduit into a target array.
Returns the number of bytes stored into dst, which may be less than
requested.
- InputStream flush() [override] ¶#
-
Clear any buffered content. No-op.
- class BzipException : IOException ¶#
-
This exception is thrown when an error occurs in the underlying bzip2
library.
- class BzipClosedException : IOException ¶#
-
This exception is thrown if you attempt to perform a read, write or flush
operation on a closed bzip2 filter stream. This can occur if the input
stream has finished, or an output stream was flushed.