Edit AllPages

An NSValueTransformer that decompresses NSData into an NSString using my NSData+Bzip2 category (see NSDataPlusBzip). It is reversible. � BryanWoods

// Bzip2ValueTransformer.h @interface Bzip2ValueTransformer : NSValueTransformer


// Bzip2ValueTransformer.m #import “Bzip2ValueTransformer.h” #import “NSData+Bzip2.h”

@implementation Bzip2ValueTransformer


To give an idea of how it’s used, my test project is just a Cocoa Document-based Application with an [[NSTextView bound (�la CocoaBindings) to an NSData in MyDocument. Selecting Bzip2ValueTransformer in the Bindings palette in Interface Builder handles all of the heavy lifting.

// MyDocument.h @interface MyDocument : NSDocument { NSData * text; }


// MyDocument.m #import “MyDocument.h” #import “Bzip2ValueTransformer.h”

@implementation MyDocument