Hi Allen,

I added the new callback interface. With the following code you can read and write bzip2 compressed files. Adding a 7zip filter should be quite easy.

Andreas

#include <boost/iostreams/filtering_stream.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filter/bzip2.hpp>

namespace io = boost::iostreams;

// add our own read and write callback
SceneFileHandler::the().setReadCB(readCB);
SceneFileHandler::the().setWriteCB(writeCB);

NodePtr readCB(SceneFileType *type,
               std::istream &is, const Char8* ext)
{
    io::filtering_istream uncompress;
    uncompress.push(io::bzip2_decompressor());
    uncompress.push(is);
    return type->read(uncompress, ext);
}

bool writeCB(SceneFileType *type,
             const NodePtr &node, std::ostream &os,
             const Char8 *ext, bool compress)
{
    io::filtering_ostream compress;
    compress.push(io::bzip2_compressor());
    compress.push(os);
    return type->write(node, compress, ext);
}

I hadn't really given much thought to using another compression library.

If OpenSG was going to add support for something beyond zlib, what about supporting 7zip (http://www.7-zip.org)? It seems to get the best compression ratios out there and it supports ZIP, CAV, RAR, ARJ, gzip, bzip2, tar, cpio, rpm, and deb. (in other words it would give us a lot of options)

I don't fully understand how the current compression stream stuff in OpenSG works, but could someone that does comment on how hard it would be to add support for a new type of compressed stream? Does the OpenSG load/save system allow for arbitrary piping of file stream modifiers/loaders or how does this work?

-Allen

Antonio Bleile wrote:

Hi Allen,

I recently ran into a similar problem. I had to
deploy an application via internet containing
a zip archive which I had to deflate on the client side (programmatically). I found this very useful zip/unzip api:

http://www.winimage.com/zLibDll/minizip.html

I haven't used the crypting features, but I saw
that it is somehow supported. It might be
useful for you as well.

Regards,

 Toni


-----Messaggio originale-----
Da: [EMAIL PROTECTED] [mailto:opensg-users-
[EMAIL PROTECTED] Per conto di Allen Bierbaum
Inviato: venerdì 11 novembre 2005 15.24
A: opensg-users
Oggetto: [Opensg-users] Encryption of loaded files

I need a simple fast way to ship data files with an application in such
a way that they can only be loaded with that application.

I know that it is possible to load gzip compressed files with OpenSG,
but has anyone ever done anything with supporting encrypted files?

I am not asking for anything too complex here, even just support for a
file stream modifier that XOR'ed a user defined key against all the
bytes coming through would work well enough for me.

-Allen


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users





-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users


__________ NOD32 1.1283 (20051110) Information __________

Diese E-Mail wurde vom NOD32 antivirus system geprüft
http://www.nod32.com






-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to