Home » Community » U++ community news and announcements » FilterStreams
| FilterStreams [message #39150] |
Tue, 19 February 2013 11:06 |
 |
mirek
Messages: 14285 Registered: November 2005
|
Ultimate Member |
|
|
New InFilterStream and OutFilterStream are classes intended for gluing input or output stream with some filter, typically with compression object. InFilterStream can be alternatively used to convert any data source to input stream.
reference/FilterStream:
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
String path = GetHomeDirFile("test.gz");
{
FileOut fout(path);
Zlib zlib;
OutFilterStream out(fout, zlib);
zlib.GZip().Compress();
out.Put("Hello world!");
out.Close();
}
{
FileIn fin(path);
Zlib zlib;
InFilterStream in(fin, zlib);
zlib.GZip().Decompress();
LOG(in.GetLine());
}
{
HttpRequest http("www.ultimatepp.org");
InFilterStream in;
http.WhenContent = callback(&in, &InFilterStream::Out);
in.More = callback(&http, &HttpRequest::Do);
http.Blocking();
while(!in.IsEof())
LOG(in.GetLine());
}
}
|
|
|
|
Goto Forum:
Current Time: Wed Jan 28 22:23:53 CET 2026
Total time taken to generate the page: 0.15855 seconds
|