diff --git a/lib/cocoa/src/transport/TMemoryBuffer.h b/lib/cocoa/src/transport/TMemoryBuffer.h index 45a5e1780..fa4d37136 100644 --- a/lib/cocoa/src/transport/TMemoryBuffer.h +++ b/lib/cocoa/src/transport/TMemoryBuffer.h @@ -25,4 +25,5 @@ NSUInteger mOffset; } - (id)initWithData:(NSData *)data; +- (NSData *)getBuffer; @end diff --git a/lib/cocoa/src/transport/TMemoryBuffer.m b/lib/cocoa/src/transport/TMemoryBuffer.m index 7912bcd76..869010a45 100644 --- a/lib/cocoa/src/transport/TMemoryBuffer.m +++ b/lib/cocoa/src/transport/TMemoryBuffer.m @@ -23,6 +23,14 @@ #define GARBAGE_BUFFER_SIZE 4096 // 4KiB @implementation TMemoryBuffer +- (id)init { + if (self = [super init]) { + mBuffer = [[NSMutableData alloc] init]; + mOffset = 0; + } + return self; +} + - (id)initWithData:(NSData *)data { if (self = [super init]) { mBuffer = [data mutableCopy]; @@ -52,6 +60,10 @@ // noop } +- (NSData *)getBuffer { + return [[mBuffer copy] autorelease]; +} + - (void)dealloc { [mBuffer release]; [super dealloc];