@@ -215,10 +215,12 @@ /** * @brief Whether the stream can block. * * By default, a stream can block. * On Win32, setting this currently only works for sockets! + * + * @throw OFSetOptionFailedException The option could not be set */ @property (nonatomic) bool canBlock; /** * @brief The delegate for asynchronous operations on the stream. @@ -262,10 +264,12 @@ * * @param buffer The buffer into which the data is read * @param length The length of the data that should be read. * The buffer *must* be *at least* this big! * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading the specified amount * @throw OFNotOpenException The stream is not open */ - (void)readIntoBuffer: (void *)buffer exactLength: (size_t)length; #ifdef OF_HAVE_SOCKETS @@ -476,10 +480,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A uint8_t from the stream * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (uint8_t)readInt8; /** @@ -488,10 +494,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A uint16_t from the stream in native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (uint16_t)readBigEndianInt16; /** @@ -500,10 +508,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A uint32_t from the stream in the native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (uint32_t)readBigEndianInt32; /** @@ -512,10 +522,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A uint64_t from the stream in the native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (uint64_t)readBigEndianInt64; /** @@ -524,10 +536,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A float from the stream in the native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (float)readBigEndianFloat; /** @@ -536,10 +550,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A double from the stream in the native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (double)readBigEndianDouble; /** @@ -548,10 +564,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A uint16_t from the stream in native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (uint16_t)readLittleEndianInt16; /** @@ -560,10 +578,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A uint32_t from the stream in the native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (uint32_t)readLittleEndianInt32; /** @@ -572,10 +592,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A uint64_t from the stream in the native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (uint64_t)readLittleEndianInt64; /** @@ -584,10 +606,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A float from the stream in the native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (float)readLittleEndianFloat; /** @@ -596,10 +620,12 @@ * @warning Only call this when you know that enough data is available! * Otherwise you will get an exception! * * @return A double from the stream in the native endianess * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (double)readLittleEndianDouble; /** @@ -610,10 +636,12 @@ * Otherwise you will get an exception! * * @param count The number of items to read * @return OFData with count items. * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (OFData *)readDataWithCount: (size_t)count; /** @@ -625,10 +653,12 @@ * * @param itemSize The size of each item * @param count The number of items to read * @return OFData with count items. * @throw OFReadFailedException Reading failed + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (OFData *)readDataWithItemSize: (size_t)itemSize count: (size_t)count; /** @@ -655,10 +685,12 @@ * @param length The length (in bytes) of the string to read from the stream * @return A string with the specified length * @throw OFReadFailedException Reading failed * @throw OFInvalidEncodingException The string read from the stream has * invalid encoding + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (OFString *)readStringWithLength: (size_t)length; /** @@ -676,10 +708,12 @@ * @param length The length (in bytes) of the string to read from the stream * @return A string with the specified length * @throw OFReadFailedException Reading failed * @throw OFInvalidEncodingException The string read from the stream has * invalid encoding + * @throw OFTruncatedDataException The end of the stream was reached before + * reading enough bytes * @throw OFNotOpenException The stream is not open */ - (OFString *)readStringWithLength: (size_t)length encoding: (OFStringEncoding)encoding;