Re: Cocoa Wantabe - need compression and encryption
Re: Cocoa Wantabe - need compression and encryption
- Subject: Re: Cocoa Wantabe - need compression and encryption
- From: saratchandra kongara <email@hidden>
- Date: Thu, 15 Jul 2004 22:20:59 -0700 (PDT)
Hi James,
For data compression you can use the zip command line
tool. I am just copying and pasting some code from one
of my projects.
zipTask = [[NSTask alloc] init];
cmdArguments = [NSArray arrayWithObjects:@"-r",
tempFilePath, [filePath lastPathComponent], nil];
[zipTask setLaunchPath:@"/usr/bin/zip"];
[zipTask setCurrentDirectoryPath [filePath
stringByDeletingLastPathComponent]];
[zipTask setArguments:cmdArguments];
[zipTask launch];
[zipTask waitUntilExit];
status = [zipTask terminationStatus];
Basically the idea is to use NSTask to call command
line tools. Take a look at the classes in the
Foundation framework for Multi-threading (NSThread),
syncronization/semaphores/queues (NSLock), process
spawning, memory management
(Retain/Release/Autorelease), Unicode support
(NSString), large collections (NSDictionary,
NSMutableArray etc), etc.
Regards
Sarat
--- James Bucanek <email@hidden> wrote:
>
Greetings,
>
>
Fist off, my apologies in advance if this is the
>
wrong place to post this. I've only been a member
>
of the list for about 5 minutes. ;)
>
>
Further, please understand that I've done almost
>
zero research on this -- and I'm not asking anyone
>
else to it either. I'm just hoping that these are
>
straight forward questions that experienced people
>
can answer off the top of their heads. If something
>
needs to be investigated, just point me in the right
>
direction. I'm not asking anyone to do it for me.
>
>
Here's my situation: I'm currently contemplating
>
developing a commercial, Mac specific,
>
application/utility. It will probably run as two
>
processes, a GUI client and a background server.
>
>
Now it's obvious that the client part of this
>
project should be in Cocoa. I assume I'll develop
>
it in XCode.
>
>
I have absolutely no experience in Obj-C. Despite
>
working with, around, and on, Apples since the Apple
>
(not the Apple ][, mind you -- the original kit
>
Apple), I've managed to skirt around Obj-C until
>
now. Most of my "real" programming expertise is C,
>
C++, and Java.
>
>
Which brings me to my question/delimma: The server
>
portion of this could easily be written in Java,
>
with the (Cocoa) client and the server communicating
>
via TCP or some other messaging scheme. But there's
>
going to be some impedance mismatch between Obj-C
>
and Java (data type conversion, differences in file
>
handling, etc.), plus my server will need access to
>
a lot of Mac specific information (file metadata,
>
resource forks, UNIX permissions) which means my
>
Java code is going to be peppered with native calls
>
to the OS and other glue. This just seems ugly.
>
>
The alternative is to write the server in Obj-C too.
>
(Who really cares about other platforms anyway?)
>
However, one huge advantage to using Java is that it
>
has many of the frameworks and libraries I need to
>
get the job done. So I'm wondering if Cocoa/Obj-C
>
has access to some of the following:
>
>
(1) Data compression. Java has the java.util.zip
>
package with direct access to ZIP, GZIP, and ZLIB
>
compression algorithms. Pump bytes in, get
>
compressed bytes out.
>
>
(2) Data encryption. Again, Java has a robust
>
framework for encrypting and decrypting data,
>
generating keys, handling secure sockets, and so on.
>
>
As an, essentially, C application I *assume* it will
>
have access to all of the OpenSSL libraries which I
>
think should solve (2). However, I'm not finding
>
any system facilities to do anything but simple
>
(LZW) compression. I don't want to rely on
>
third-party solutions (unless they are open source
>
and mature), and I'm NOT going to roll my own
>
advanced compression routines. Is there a robust
>
and efficient compression library which I can
>
leverage directly from Obj-C? The efficiency (both
>
in terms of CPU time and compaction) is critical to
>
my application. Data integrity is priority #1.
>
>
Lastly, I'm not getting into an argument about Obj-C
>
vs. Java. I've done my homework there, and I pretty
>
much know the strengths and weaknesses of each. I'm
>
also assuming that a Cocoa app can handle all the
>
basics: Multi-threading,
>
syncronization/semaphores/queues, process spawning,
>
memory management, Unicode support, large
>
collections, etc.
>
>
James
>
>
P.S. Be careful how you answer these questions. If
>
you convince me to write my app in Obj-C, I'll be
>
coming back over the next few months with a lot more
>
questions. ;)
>
>
--
>
James Bucanek <mailto:email@hidden>
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be
>
ignored.
>
>
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.