A base class for different types of streams. More...
#import <OFStream.h>
Public Member Functions | |
(BOOL) | - atEndOfStream |
(BOOL) | - atEndOfStreamWithoutCache |
(size_t) | - readNBytes:intoBuffer: |
(size_t) | - readNBytesWithoutCache:intoBuffer: |
(OFString *) | - readLine |
(OFString *) | - readLineWithEncoding: |
(size_t) | - writeNBytes:fromBuffer: |
(size_t) | - writeString: |
(id) | - close |
Protected Attributes | |
char * | cache |
size_t | cache_len |
A base class for different types of streams.
- (BOOL) atEndOfStream |
Returns a boolean whether the end of the stream has been reached.
IMPORTANT: Do *NOT* override this in subclasses! Override atEndOfStreamWithoutCache instead, as otherwise, you *WILL* break caching and thus get broken results!
- (BOOL) atEndOfStreamWithoutCache |
Returns a boolean whether the end of the stream has been reached without looking at the cache.
IMPORTANT: Do *NOT* use this! Use atEndOfCache instead, as this is *ONLY* for being overriden in subclasses!
- (id) close |
Closes the stream.
- (OFString *) readLine |
Read until a newline, \0 or end of stream occurs.
- (OFString *) readLineWithEncoding: | (enum of_string_encoding) | encoding |
Read with the specified encoding until a newline, \0 or end of stream occurs.
- (size_t) readNBytes: | (size_t) | size | ||
intoBuffer: | (char*) | buf | ||
Reads from the stream into a buffer.
IMPORTANT: Do *NOT* override this in subclasses! Override readNBytesWithoutCache:intoBuffer: instead, as otherwise, you *WILL* break caching and thus get broken results!
buf | The buffer into which the data is read | |
size | The size of the data that should be read. The buffer MUST be at least size big! |
- (size_t) readNBytesWithoutCache: | (size_t) | size | ||
intoBuffer: | (char*) | buf | ||
Reads from the stream into a buffer without looking at the cache.
IMPORTANT: Do *NOT* use this! Use readNBytes:intoBuffer: instead, as this is *ONLY* for being overriden in subclasses!
buf | The buffer into which the data is read | |
size | The size of the data that should be read. The buffer MUST be at least size big! |
- (size_t) writeNBytes: | (size_t) | size | ||
fromBuffer: | (const char*) | buf | ||
Writes from a buffer into the stream.
buf | The buffer from which the data is written to the stream | |
size | The size of the data that should be written |
- (size_t) writeString: | (OFString*) | str |
Writes a string into the stream, without the trailing zero.
str | The string from which the data is written to the stream |