Created
March 30, 2010 15:12
-
-
Save karlforshaw/349180 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation DataDelegate : CPObject | |
- (void)connection:(CPURLConnection)aConnection didReceiveData:(CPString)data | |
{ | |
// Process the data and test it's integrity | |
CPLog.info('Recieved Data'); | |
var unarchiver = [[CPKeyedUnarchiver alloc] initForReadingWithData:[CPData dataWithString:data]]; | |
var presentation = [unarchiver decodeObjectForKey:"DocumentPresentationKey"]; | |
[unarchiver finishDecoding]; | |
if(! presentation) { | |
CPLog.error("Presentation data could not be unarchived"); | |
return true; | |
} | |
// Create an output stream and export | |
var pptxFile = tempFileForType("pptx"); | |
var output = new FileOutputStream(pptxFile); | |
// Write the output | |
[presentation exportPPTX:output]; | |
} | |
- (void)connection:(CPURLConnection)aConnection didFailWithError:(CPString)error | |
{ | |
CPLog.error('No Data Recieved: ' + error); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment