|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I'd like to write compressed data to a file.
To improve performance, I want to use buffer. I read some books, they all talk about 'character' stream. But I think compressed data should be binary. And, what buffer size if optimal? How can I set the buffer size? I need to checkpoint the buffer when 1) the buffer is full. 2) I have put all the data to the buffer. Should I use standard library or boost? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Lambda a écrit :
> I'd like to write compressed data to a file. > To improve performance, I want to use buffer. > > [snip] > And, what buffer size if optimal? That depends on your architecture, the algorithm you use ... > How can I set the buffer size? You cannot but you can set the buffer to use with a call to streambuf::pubsetbuf(). > I need to checkpoint the buffer when > 1) the buffer is full. You can overload streambuf: verflow()> 2) I have put all the data to the buffer. I don't think you can know that but perhaps at flush() time. > Should I use standard library or boost? Boost.IOstream already provides compression and decompression in the zlib, gzip and bzip2 formats. It would save you time. Using their generic stream implementation might be a good idea; I don't know. For more information about streambuf, see: http://www.cplusplus.com/reference/iostream/streambuf/ -- Michael |
|
![]() |
| Outils de la discussion | |
|
|