Skip to content

Instantly share code, notes, and snippets.

@pavelosipov
Last active December 20, 2015 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavelosipov/3cc5dd9fb559aa9b47f7 to your computer and use it in GitHub Desktop.
Save pavelosipov/3cc5dd9fb559aa9b47f7 to your computer and use it in GitHub Desktop.
Custom NSInputStream factory method
@interface NSInputStream (MRC)
+ (instancetype)mrc_inputStreamWithData:(NSData *)data;
@end
@implementation NSInputStream (MRC)
+ (instancetype)mrc_inputStreamWithData:(NSData *)data {
MRCDataStreamDataSource *dataSource = [[MRCDataStreamDataSource alloc] initWithData:data];
POSBlobInputStream *stream = [[POSBlobInputStream alloc] initWithDataSource:dataSource];
stream.shouldNotifyCoreFoundationAboutStatusChange = NO;
return stream;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment