Updating ITFoundation project and target settings to the minimum required.
[ITFoundation.git] / ITByteStream.h
1 /*
2  *      ITFoundation
3  *      ITByteStream.h
4  *
5  *      Copyright (c) 2005 by iThink Software.
6  *      All Rights Reserved.
7  *
8  *      $Id$
9  *
10  */
11
12 #import <Foundation/Foundation.h>
13
14 @protocol ITDataReceiver;
15
16 @protocol ITDataProvider <NSObject>
17 - (id <ITDataReceiver>)setDelegate:(id <ITDataReceiver>)delegate;
18 - (id <ITDataReceiver>)delegate;
19 @end
20
21 @protocol ITDataReceiver <NSObject>
22 -(oneway void)newDataAdded:(id <ITDataProvider>)sender;
23 @end
24
25 @interface ITByteStream : NSObject <ITDataProvider> {
26         @public
27         NSMutableData *data;
28         @private
29         NSLock *lock;
30         id <ITDataReceiver> delegate;
31 }
32
33 - (id)initWithDelegate:(id <ITDataReceiver>)delegate;
34 - (id)initWithStream:(ITByteStream *)stream delegate:(id <ITDataReceiver>)d;
35 - (int)availableDataLength;
36 - (NSData*)readDataOfLength:(int)length;
37 - (NSData*)readAllData;
38 - (void)writeData:(in NSData *)data;
39 - (void)writeBytes:(in char *)b len:(long)length;
40 - (void)lockStream;
41 - (void)unlockStream;
42 - (void)shortenData:(long)length;
43 - (id <ITDataReceiver>)setDelegate:(id <ITDataReceiver>)delegate;
44 - (id <ITDataReceiver>)delegate;
45
46 @end