Doesn't crash now. Of course, there's still lots of problems.
[ITFoundation.git] / ITByteStream.h
1 //
2 //  ITByteStream.h
3 //  ITFoundation
4 //
5 //  Created by Alexander Strange on Thu Feb 27 2003.
6 //  Copyright (c) 2003 __MyCompanyName__. All rights reserved.
7 //
8
9 #import <Foundation/Foundation.h>
10
11 @class ITByteStream;
12
13 @protocol ITByteStreamDelegate
14 -(void)newDataAdded:(ITByteStream *)sender;
15 @end
16
17 @interface ITByteStream : NSObject {
18     @public
19     NSMutableData *data;
20     @private
21     NSLock *lock;
22     id <ITByteStreamDelegate> delegate;
23 }
24 -(id) initWithStream:(ITByteStream*)stream delegate:(id <ITByteStreamDelegate>)d;
25 -(id) initWithDelegate:(id <ITByteStreamDelegate>)d;
26 -(void) setDelegate:(id <ITByteStreamDelegate>)d;
27 -(int) availableDataLength;
28 -(NSData*) readDataOfLength:(int)length;
29 -(NSData*) readAllData;
30 -(void) writeData:(in NSData*)data;
31 -(void) writeBytes:(char *)b len:(long)length;
32 @end