Doesn't crash now. Of course, there's still lots of problems.
[ITFoundation.git] / ITByteStream.h
index 265b7a6..52297c5 100755 (executable)
@@ -8,15 +8,25 @@
 
 #import <Foundation/Foundation.h>
 
-/*! @class ITByteStream
- *  @abstract A FIFO bytestream
- */
+@class ITByteStream;
+
+@protocol ITByteStreamDelegate
+-(void)newDataAdded:(ITByteStream *)sender;
+@end
 
 @interface ITByteStream : NSObject {
+    @public
     NSMutableData *data;
+    @private
+    NSLock *lock;
+    id <ITByteStreamDelegate> delegate;
 }
--(id) initWithStream:(ITByteStream*)stream;
+-(id) initWithStream:(ITByteStream*)stream delegate:(id <ITByteStreamDelegate>)d;
+-(id) initWithDelegate:(id <ITByteStreamDelegate>)d;
+-(void) setDelegate:(id <ITByteStreamDelegate>)d;
 -(int) availableDataLength;
 -(NSData*) readDataOfLength:(int)length;
--(void) writeData:(NSData*)data;
+-(NSData*) readAllData;
+-(void) writeData:(in NSData*)data;
+-(void) writeBytes:(char *)b len:(long)length;
 @end