Index: src/OFDataArray.h ================================================================== --- src/OFDataArray.h +++ src/OFDataArray.h @@ -216,10 +216,17 @@ /** * \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. * Index: src/OFDataArray.m ================================================================== --- src/OFDataArray.m +++ src/OFDataArray.m @@ -389,10 +389,23 @@ - (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 {