ObjFW  Check-in [36e48a23f8]

Overview
Comment:Add -[OFDataArray writeToFile:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 36e48a23f8412713d771e8b4641a9aa8c42357f6055c4b1e1e35167ca6609144
User & Date: js on 2011-04-25 17:28:46
Other Links: manifest | tags
Context
2011-04-25
18:04
Update ChangeLog. check-in: a3efe17ba0 user: js tags: trunk
17:28
Add -[OFDataArray writeToFile:]. check-in: 36e48a23f8 user: js tags: trunk
17:14
Skip possible BOMs in OFMutableString. check-in: 7aefcd5ede user: js tags: trunk
Changes

Modified src/OFDataArray.h from [c05a7401db] to [820a9e7684].

214
215
216
217
218
219
220







221
222
223
224
225
226
227
- (void)removeNItems: (size_t)nItems
	     atIndex: (size_t)index;

/**
 * \return A string containing the data in Base64 encoding
 */
- (OFString*)stringByBase64Encoding;







@end

/**
 * \brief A class for storing arbitrary big data in an array.
 *
 * The OFBigDataArray class is a class for storing arbitrary data in an array
 * and is designed to store large hunks of data. Therefore, it allocates







>
>
>
>
>
>
>







214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
- (void)removeNItems: (size_t)nItems
	     atIndex: (size_t)index;

/**
 * \return A string containing the data in Base64 encoding
 */
- (OFString*)stringByBase64Encoding;

/**
 * Writes the OFDataArray into the specified file.
 *
 * \param path The path of the file to write to
 */
- (void)writeToFile: (OFString*)path;
@end

/**
 * \brief A class for storing arbitrary big data in an array.
 *
 * The OFBigDataArray class is a class for storing arbitrary data in an array
 * and is designed to store large hunks of data. Therefore, it allocates

Modified src/OFDataArray.m from [738291762c] to [8cfd028dbb].

387
388
389
390
391
392
393













394
395
396
397
398
399
400
	return hash;
}

- (OFString*)stringByBase64Encoding
{
	return of_base64_encode(data, count * itemSize);
}













@end

@implementation OFBigDataArray
- (void)addItem: (const void*)item
{
	size_t newSize, lastPageByte;








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







387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
	return hash;
}

- (OFString*)stringByBase64Encoding
{
	return of_base64_encode(data, count * itemSize);
}

- (void)writeToFile: (OFString*)path
{
	OFFile *file = [[OFFile alloc] initWithPath: path
					       mode: @"wb"];

	@try {
		[file writeNBytes: count * itemSize
		       fromBuffer: data];
	} @finally {
		[file release];
	}
}
@end

@implementation OFBigDataArray
- (void)addItem: (const void*)item
{
	size_t newSize, lastPageByte;