ObjFW  Diff

Differences From Artifact [428dff50a5]:

To Artifact [8627416ee2]:


104
105
106
107
108
109
110





















































111
112
113
114
115
116
117
 * \param buffer The buffer into which the data is read
 * \param length The length of the data that should be read.
 *		 The buffer <i>must</i> be <i>exactly</i> this big!
 */
 - (void)readIntoBuffer: (void*)buffer
	    exactLength: (size_t)length;






















































#ifdef OF_HAVE_BLOCKS
/**
 * \brief Asyncronously reads <i>at most</i> size bytes from the stream into a
 *	  buffer.
 *
 * On network streams, this might read less than the specified number of bytes.
 * If you want to read exactly the specified number of bytes, use







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
 * \param buffer The buffer into which the data is read
 * \param length The length of the data that should be read.
 *		 The buffer <i>must</i> be <i>exactly</i> this big!
 */
 - (void)readIntoBuffer: (void*)buffer
	    exactLength: (size_t)length;

/**
 * \brief Asyncronously reads <i>at most</i> size bytes from the stream into a
 *	  buffer.
 *
 * On network streams, this might read less than the specified number of bytes.
 * If you want to read exactly the specified number of bytes, use
 * asyncReadIntoBuffer:exactLength:block:. Note that a read can even return 0
 * bytes - this does not necessarily mean that the stream ended, so you still
 * need to check isAtEndOfStream.
 *
 * \param buffer The buffer into which the data is read.
 *		 The buffer must not be free'd before the async read completed!
 * \param length The length of the data that should be read at most.
 *		 The buffer <i>must</i> be at least this big!
 * \param target The target on which the selector should be called when the
 *		 data has been received. If the method returns YES, it will be
 *		 called again with the same buffer and maximum length when more
 *		 data has been received. If you want the next method in the
 *		 queue to handle the data received next, you need to return NO
 *		 from the method.
 * \param selector The selector to call on the target. The signature must be
 *		   BOOL (OFStream *stream, void *buffer, size_t size).
 */
- (void)asyncReadIntoBuffer: (void*)buffer
		     length: (size_t)length
		     target: (id)target
		   selector: (SEL)selector;

/**
 * \brief Asyncronously reads exactly the specified length bytes from the
 *	  stream into a buffer.
 *
 * Unlike asyncReadIntoBuffer:length:block, this method does not call the
 * method when less than the specified length has been read - instead, it waits
 * until it got exactly the specified length or the stream has ended.
 *
 * \param buffer The buffer into which the data is read
 * \param length The length of the data that should be read.
 *		 The buffer <i>must</i> be <i>exactly</i> this big!
 * \param target The target on which the selector should be called when the
 *		 data has been received. If the method returns YES, it will be
 *		 called again with the same buffer and exact length when more
 *		 data has been received. If you want the next method in the
 *		 queue to handle the data received next, you need to return NO
 *		 from the method.
 * \param selector The selector to call on the target. The signature must be
 *		   BOOL (OFStream *stream, void *buffer, size_t size).
 */
 - (void)asyncReadIntoBuffer: (void*)buffer
		 exactLength: (size_t)length
		      target: (id)target
		    selector: (SEL)selector;

#ifdef OF_HAVE_BLOCKS
/**
 * \brief Asyncronously reads <i>at most</i> size bytes from the stream into a
 *	  buffer.
 *
 * On network streams, this might read less than the specified number of bytes.
 * If you want to read exactly the specified number of bytes, use
497
498
499
500
501
502
503
































504
505
506
507
508
509
510
 *
 * \param encoding The encoding used by the stream
 * \return The line that was read, autoreleased, or nil if the end of the
 *	   stream has been reached.
 */
- (OFString*)readLineWithEncoding: (of_string_encoding_t)encoding;

































#ifdef OF_HAVE_BLOCKS
/**
 * \brief Asyncronously reads until a newline, \\0 or end of stream occurs.
 *
 * \param block The block to call when the data has been received.
 *		If the block returns YES, it will be called again when the next
 *		line has been received. If you want the next block in the queue







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
 *
 * \param encoding The encoding used by the stream
 * \return The line that was read, autoreleased, or nil if the end of the
 *	   stream has been reached.
 */
- (OFString*)readLineWithEncoding: (of_string_encoding_t)encoding;

/**
 * \brief Asyncronously reads with the specified encoding until a newline, \\0
 *	  or end of stream occurs.
 *
 * \param target The target on which to call the selector when the data has
 *		 been received. If the method returns YES, it will be called
 *		 again when the next line has been received. If you want the
 *		 next method in the queue to handle the next line, you need to
 *		 return NO from the method
 * \param selector The selector to call on the target. The signature must be
 *		   BOOL (OFStream *stream, OFString *line).
 */
- (void)asyncReadLineWithTarget: (id)target
		       selector: (SEL)selector;

/**
 * \brief Asyncronously reads with the specified encoding until a newline, \\0
 *	  or end of stream occurs.
 *
 * \param encoding The encoding used by the stream
 * \param target The target on which to call the selector when the data has
 *		 been received. If the method returns YES, it will be called
 *		 again when the next line has been received. If you want the
 *		 next method in the queue to handle the next line, you need to
 *		 return NO from the method
 * \param selector The selector to call on the target. The signature must be
 *		   BOOL (OFStream *stream, OFString *line).
 */
- (void)asyncReadLineWithEncoding: (of_string_encoding_t)encoding
			   target: (id)target
			 selector: (SEL)selector;

#ifdef OF_HAVE_BLOCKS
/**
 * \brief Asyncronously reads until a newline, \\0 or end of stream occurs.
 *
 * \param block The block to call when the data has been received.
 *		If the block returns YES, it will be called again when the next
 *		line has been received. If you want the next block in the queue
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
 *
 * \param buffer The buffer for the data to read
 * \param length The length of the buffer
 * \return The number of bytes read
 */
- (size_t)lowlevelReadIntoBuffer: (void*)buffer
			  length: (size_t)length;


/**
 * \brief Performs a lowlevel write.
 *
 * \warning Do not call this directly!
 *
 * Override this method with your actual write implementation when subclassing!







<







1002
1003
1004
1005
1006
1007
1008

1009
1010
1011
1012
1013
1014
1015
 *
 * \param buffer The buffer for the data to read
 * \param length The length of the buffer
 * \return The number of bytes read
 */
- (size_t)lowlevelReadIntoBuffer: (void*)buffer
			  length: (size_t)length;


/**
 * \brief Performs a lowlevel write.
 *
 * \warning Do not call this directly!
 *
 * Override this method with your actual write implementation when subclassing!