Index: src/OFStream.h ================================================================== --- src/OFStream.h +++ src/OFStream.h @@ -146,19 +146,31 @@ * \return A uint64_t from the stream in the native endianess */ - (uint64_t)readLittleEndianInt64; /** - * Reads nitems items with the specified item size from the stream and returns + * Reads nItems items with an item size of 1 from the stream and returns them + * in an OFDataArray. + * + * WARNING: Only call this when you know that enough data is available! + * Otherwise you will get an exception! + * + * \param nItems The number of items to read + * \return An OFDataArray with at nItems items. + */ +- (OFDataArray*)readDataArrayWithNItems: (size_t)nItems; + +/** + * Reads nItems items with the specified item size from the stream and returns * them in an OFDataArray. * * WARNING: Only call this when you know that enough data is available! * Otherwise you will get an exception! * * \param itemSize The size of each item - * \param nItems The number of iteams to read - * \return An OFDataArray with at nitems items. + * \param nItems The number of items to read + * \return An OFDataArray with at nItems items. */ - (OFDataArray*)readDataArrayWithItemSize: (size_t)itemSize andNItems: (size_t)nItems; /** Index: src/OFStream.m ================================================================== --- src/OFStream.m +++ src/OFStream.m @@ -202,10 +202,16 @@ [self readExactlyNBytes: 8 intoBuffer: (char*)&ret]; return of_bswap64_if_be(ret); } + +- (OFDataArray*)readDataArrayWithNItems: (size_t)nItems +{ + return [self readDataArrayWithItemSize: 1 + andNItems: nItems]; +} - (OFDataArray*)readDataArrayWithItemSize: (size_t)itemSize andNItems: (size_t)nItems { OFDataArray *da;