#include <bzip2.h>
Bzip Compression Filter
Definition at line 19 of file bzip2.h.
◆ Bzip_Compression()
| Botan::Bzip_Compression::Bzip_Compression |
( |
size_t | l = 9 | ) |
|
Definition at line 95 of file bzip2.cpp.
95 :
96 level((l >= 9) ? 9 : l), buffer(DEFAULT_BUFFERSIZE)
97 {
98 bz = 0;
99 }
◆ ~Bzip_Compression()
| Botan::Bzip_Compression::~Bzip_Compression |
( |
| ) |
|
|
inline |
◆ attachable()
| virtual bool Botan::Filter::attachable |
( |
| ) |
|
|
inlinevirtualinherited |
◆ end_msg()
| void Botan::Bzip_Compression::end_msg |
( |
| ) |
|
|
virtual |
Notify that the current message is finished; flush buffers and do end-of-message processing (if any).
Reimplemented from Botan::Filter.
Definition at line 132 of file bzip2.cpp.
133 {
134 bz->stream.next_in = 0;
135 bz->stream.avail_in = 0;
136
137 int rc = BZ_OK;
138 while(rc != BZ_STREAM_END)
139 {
140 bz->stream.next_out = reinterpret_cast<char*>(buffer.begin());
141 bz->stream.avail_out = buffer.size();
142 rc = BZ2_bzCompress(&(bz->stream), BZ_FINISH);
143 send(buffer, buffer.size() - bz->stream.avail_out);
144 }
145 clear();
146 }
void send(const byte in[], size_t length)
References Botan::Filter::send().
◆ flush()
| void Botan::Bzip_Compression::flush |
( |
| ) |
|
Definition at line 151 of file bzip2.cpp.
152 {
153 bz->stream.next_in = 0;
154 bz->stream.avail_in = 0;
155
156 int rc = BZ_OK;
157 while(rc != BZ_RUN_OK)
158 {
159 bz->stream.next_out = reinterpret_cast<char*>(buffer.begin());
160 bz->stream.avail_out = buffer.size();
161 rc = BZ2_bzCompress(&(bz->stream), BZ_FLUSH);
162 send(buffer, buffer.size() - bz->stream.avail_out);
163 }
164 }
References Botan::Filter::send().
◆ name()
| std::string Botan::Bzip_Compression::name |
( |
| ) |
const |
|
inlinevirtual |
- Returns
- descriptive name for this filter
Implements Botan::Filter.
Definition at line 22 of file bzip2.h.
22{ return "Bzip_Compression"; }
◆ send() [1/4]
| void Botan::Filter::send |
( |
byte | in | ) |
|
|
inlineprotectedinherited |
- Parameters
-
| in | some input for the filter |
Definition at line 63 of file filter.h.
References send().
Referenced by send().
◆ send() [2/4]
| void Botan::Filter::send |
( |
const byte | in[], |
|
|
size_t | length ) |
|
protectedinherited |
- Parameters
-
| in | some input for the filter |
| length | the length of in |
Definition at line 28 of file filter.cpp.
29 {
30 bool nothing_attached = true;
31 for(size_t j = 0; j != total_ports(); ++j)
32 if(next[j])
33 {
34 if(write_queue.size())
35 next[j]->write(&write_queue[0], write_queue.size());
36 next[j]->write(input, length);
37 nothing_attached = false;
38 }
39
40 if(nothing_attached)
41 write_queue += std::make_pair(input, length);
42 else
43 write_queue.clear();
44 }
Referenced by Botan::Base64_Decoder::end_msg(), Botan::Base64_Encoder::end_msg(), Botan::Bzip_Compression::end_msg(), Botan::Bzip_Decompression::end_msg(), Botan::Hash_Filter::end_msg(), Botan::Hex_Decoder::end_msg(), Botan::Hex_Encoder::end_msg(), Botan::MAC_Filter::end_msg(), Botan::PK_Decryptor_Filter::end_msg(), Botan::PK_Encryptor_Filter::end_msg(), Botan::PK_Signer_Filter::end_msg(), Botan::PK_Verifier_Filter::end_msg(), Botan::Zlib_Compression::end_msg(), Botan::Zlib_Decompression::end_msg(), Botan::Bzip_Compression::flush(), Botan::Zlib_Compression::flush(), send(), Botan::Base64_Decoder::write(), Botan::Bzip_Compression::write(), Botan::Bzip_Decompression::write(), Botan::Chain::write(), Botan::Fork::write(), Botan::Hex_Decoder::write(), Botan::StreamCipher_Filter::write(), Botan::Zlib_Compression::write(), and Botan::Zlib_Decompression::write().
◆ send() [3/4]
◆ send() [4/4]
- Parameters
-
| in | some input for the filter |
| length | the number of bytes of in to send |
Definition at line 74 of file filter.h.
References send().
◆ start_msg()
| void Botan::Bzip_Compression::start_msg |
( |
| ) |
|
|
virtual |
Start a new message. Must be closed by end_msg() before another message can be started.
Reimplemented from Botan::Filter.
Definition at line 104 of file bzip2.cpp.
105 {
106 clear();
107 bz = new Bzip_Stream;
108 if(BZ2_bzCompressInit(&(bz->stream), level, 0, 0) != BZ_OK)
109 throw Memory_Exhaustion();
110 }
◆ write()
| void Botan::Bzip_Compression::write |
( |
const byte | input[], |
|
|
size_t | length ) |
|
virtual |
Write a portion of a message to this filter.
- Parameters
-
| input | the input as a byte array |
| length | the length of the byte array input |
Implements Botan::Filter.
Definition at line 115 of file bzip2.cpp.
116 {
117 bz->stream.next_in = reinterpret_cast<char*>(const_cast<byte*>(input));
118 bz->stream.avail_in = length;
119
120 while(bz->stream.avail_in != 0)
121 {
122 bz->stream.next_out = reinterpret_cast<char*>(buffer.begin());
123 bz->stream.avail_out = buffer.size();
124 BZ2_bzCompress(&(bz->stream), BZ_RUN);
125 send(buffer, buffer.size() - bz->stream.avail_out);
126 }
127 }
References Botan::Filter::send().
The documentation for this class was generated from the following files: