2 // ITChunkedByteStream.m
5 // Created by Alexander Strange on Tue Jul 22 2003.
6 // Copyright (c) 2003 __MyCompanyName__. All rights reserved.
9 #import "ITChunkedByteStream.h"
12 @implementation ITChunkedByteStream
13 -initWithDelegate:(id)d
15 if (self = [super init]) {
16 q = [[ArrayQueue alloc] init];
17 lock = [[NSLock alloc] init];
18 delegate = [d retain];
36 d = (NSData*)[q dequeue];
41 -(oneway void) writeData:(in NSData*)d
48 -(oneway void) writeBytesNoCopy:(in char *)b len:(unsigned long)length
51 [q enqueue:[NSData dataWithBytesNoCopy:b length:length]];
55 -(oneway void) writeBytes:(in char *)b len:(unsigned long)length
58 [q enqueue:[NSData dataWithBytes:b length:length]];
61 -delegate {return delegate;}
62 -setDelegate:(id)d {id old = delegate; [delegate release]; delegate = [d retain]; return old;}