Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -126,10 +126,18 @@ * \return The number of bytes written */ - (size_t)writeNBytes: (size_t)size fromBuffer: (const char*)buf; +/** + * Writes from an OFDataArray into the stream. + * + * \param dataarray The OFDataArray to write into the stream + * \return The number of bytes written + */ +- (size_t)writeDataArray: (OFDataArray*)dataarray; + /** * Writes a string into the stream, without the trailing zero. * * \param str The string from which the data is written to the stream * \return The number of bytes written Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -390,10 +390,16 @@ fromBuffer: (const char*)buf { @throw [OFNotImplementedException newWithClass: isa selector: _cmd]; } + +- (size_t)writeDataArray: (OFDataArray*)dataarray +{ + return [self writeNBytes: [dataarray count] * [dataarray itemSize] + fromBuffer: [dataarray cArray]]; +} - (size_t)writeString: (OFString*)str { return [self writeNBytes: [str cStringLength] fromBuffer: [str cString]];