List of all members.
Detailed Description
A base class for different types of streams.
IMPORTANT: If you want to subclass this, override _readNBytes:intoBuffer:, _writeNBytes:fromBuffer: and _isAtEndOfStream, but nothing else. Those are not defined in the headers, but do the actual work. OFStream uses those and does all the caching and other stuff. If you override these methods without the _ prefix, you *WILL* break caching and get broken results!
Member Function Documentation
- Returns:
- A boolean whether writes are buffered
- Returns:
- The file descriptor for the stream.
- (void) flushWriteBuffer |
|
|
|
|
Writes everythig in the write buffer to the stream.
Returns a boolean whether the end of the stream has been reached.
- Returns:
- A boolean whether the end of the stream has been reached
- Returns:
- Whether the stream is in blocking mode
- (uint16_t) readBigEndianInt16 |
|
|
|
|
Reads a uint16_t from the stream which is encoded in big endian.
WARNING: Only call this when you know that enough data is available! Otherwise you will get an exception!
- Returns:
- A uint16_t from the stream in native endianess
- (uint32_t) readBigEndianInt32 |
|
|
|
|
Reads a uint32_t from the stream which is encoded in big endian.
WARNING: Only call this when you know that enough data is available! Otherwise you will get an exception!
- Returns:
- A uint32_t from the stream in the native endianess
- (uint64_t) readBigEndianInt64 |
|
|
|
|
Reads a uint64_t from the stream which is encoded in big endian.
WARNING: Only call this when you know that enough data is available! Otherwise you will get an exception!
- Returns:
- A uint64_t from the stream in the native endianess
- Returns:
- An OFDataArray with an item size of 1 with all the data of the stream until the end of the stream is reached.
- (OFDataArray *) readDataArrayWithItemSize: |
|
(size_t) |
itemsize |
andNItems: |
|
(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!
- Parameters:
-
| itemsize | The size of each item |
| nitems | The number of iteams to read |
- Returns:
- An OFDataArray with at nitems items.
- (void) readExactlyNBytes: |
|
(size_t) |
size |
intoBuffer: |
|
(char*) |
buf | |
|
|
| | |
Reads exactly size bytes from the stream into a buffer. Unlike readNBytes:intoBuffer:, this method does not return when less than the specified size has been read - instead, it waits until it got exactly size bytes.
WARNING: Only call this when you know that specified amount of data is available! Otherwise you will get an exception!
- Parameters:
-
| buf | The buffer into which the data is read |
| size | The size of the data that should be read. The buffer MUST be EXACTLY this big! |
Reads a uint8_t from the stream.
WARNING: Only call this when you know that enough data is available! Otherwise you will get an exception!
- Returns:
- A uint8_t from the stream
Read until a newline, \0 or end of stream occurs.
- Returns:
- The line that was read, autoreleased, or nil if the end of the stream has been reached.
- (OFString *) readLineWithEncoding: |
|
(enum of_string_encoding) |
encoding |
|
|
Read with the specified encoding until a newline, \0 or end of stream occurs.
- Parameters:
-
| encoding | The encoding used by the stream |
- Returns:
- The line that was read, autoreleased, or nil if the end of the stream has been reached.
- (uint16_t) readLittleEndianInt16 |
|
|
|
|
Reads a uint16_t from the stream which is encoded in little endian.
WARNING: Only call this when you know that enough data is available! Otherwise you will get an exception!
- Returns:
- A uint16_t from the stream in native endianess
- (uint32_t) readLittleEndianInt32 |
|
|
|
|
Reads a uint32_t from the stream which is encoded in little endian.
WARNING: Only call this when you know that enough data is available! Otherwise you will get an exception!
- Returns:
- A uint32_t from the stream in the native endianess
- (uint64_t) readLittleEndianInt64 |
|
|
|
|
Reads a uint64_t from the stream which is encoded in little endian.
WARNING: Only call this when you know that enough data is available! Otherwise you will get an exception!
- Returns:
- A uint64_t from the stream in the native endianess
- (size_t) readNBytes: |
|
(size_t) |
size |
intoBuffer: |
|
(char*) |
buf | |
|
|
| | |
Reads at most size bytes from the stream into a buffer.
- Parameters:
-
| buf | The buffer into which the data is read |
| size | The size of the data that should be read at most. The buffer MUST be at least size big! |
- Returns:
- The number of bytes read
Read until the specified string or \0 is found or the end of stream occurs.
- Parameters:
-
- Returns:
- The line that was read, autoreleased, or nil if the end of the stream has been reached.
- (OFString *) readTillDelimiter: |
|
(OFString*) |
delimiter |
withEncoding: |
|
(enum of_string_encoding) |
encoding | |
|
|
| | |
Read until the specified string or \0 is found or the end of stream occurs.
- Parameters:
-
| delimiter | The delimiter |
| encoding | The encoding used by the stream |
- Returns:
- The line that was read, autoreleased, or nil if the end of the stream has been reached.
- (void) setBlocking: |
|
(BOOL) |
enable |
|
|
Enables or disables non-blocking I/O.
By default, a stream is in blocking mode. On Win32, this currently only works for sockets!
- Parameters:
-
| enable | Whether the stream should be blocking |
- (void) setBuffersWrites: |
|
(BOOL) |
enable |
|
|
Enables or disables the write buffer.
- Parameters:
-
| enable | Whether the write buffer should be enabled or disabled |
- (void) writeBigEndianInt16: |
|
(uint16_t) |
int16 |
|
|
Writes a uint16_t into the stream, encoded in big endian.
- Parameters:
-
- (void) writeBigEndianInt32: |
|
(uint32_t) |
int32 |
|
|
Writes a uint32_t into the stream, encoded in big endian.
- Parameters:
-
- (void) writeBigEndianInt64: |
|
(uint64_t) |
int64 |
|
|
Writes a uint64_t into the stream, encoded in big endian.
- Parameters:
-
Writes from an OFDataArray into the stream.
- Parameters:
-
- Returns:
- The number of bytes written
- (size_t) writeFormat: |
|
(OFString*) |
fmt |
, |
|
|
... | |
|
|
| | |
Writes a formatted string into the stream.
- Parameters:
-
| fmt | A string used as format |
- Returns:
- The number of bytes written
- (size_t) writeFormat: |
|
(OFString*) |
fmt |
withArguments: |
|
(va_list) |
args | |
|
|
| | |
Writes a formatted string into the stream.
- Parameters:
-
| fmt | A string used as format |
| args | The arguments used in the format string |
- Returns:
- The number of bytes written
- (void) writeInt8: |
|
(uint8_t) |
int8 |
|
|
Writes a uint8_t into the stream.
- Parameters:
-
Writes a string into the stream with a trailing newline.
- Parameters:
-
| str | The string from which the data is written to the stream |
- Returns:
- The number of bytes written
- (void) writeLittleEndianInt16: |
|
(uint16_t) |
int16 |
|
|
Writes a uint16_t into the stream, encoded in little endian.
- Parameters:
-
- (void) writeLittleEndianInt32: |
|
(uint32_t) |
int32 |
|
|
Writes a uint32_t into the stream, encoded in little endian.
- Parameters:
-
- (void) writeLittleEndianInt64: |
|
(uint64_t) |
int64 |
|
|
Writes a uint64_t into the stream, encoded in little endian.
- Parameters:
-
- (size_t) writeNBytes: |
|
(size_t) |
size |
fromBuffer: |
|
(const char*) |
buf | |
|
|
| | |
Writes from a buffer into the stream.
- Parameters:
-
| buf | The buffer from which the data is written to the stream |
| size | The size of the data that should be written |
- Returns:
- The number of bytes written
Writes a string into the stream, without the trailing zero.
- Parameters:
-
| str | The string from which the data is written to the stream |
- Returns:
- The number of bytes written
The documentation for this class was generated from the following files: