ObjFW
Classes | Typedefs
OFStream.h File Reference
#include <stdarg.h>
#import "OFObject.h"
#import "OFString.h"
#import "OFRunLoop.h"
#import "OFKernelEventObserver.h"
Include dependency graph for OFStream.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

protocol  <OFStreamDelegate>
 
class  OFStream
 A base class for different types of streams. More...
 

Typedefs

typedef bool(^ of_stream_async_read_block_t) (size_t length, id _Nullable exception)
 A block which is called when data was read asynchronously from a stream. More...
 
typedef bool(^ of_stream_async_read_line_block_t) (OFString *_Nullable line, id _Nullable exception)
 A block which is called when a line was read asynchronously from a stream. More...
 
typedef OFData *_Nullable(^ of_stream_async_write_data_block_t) (OFData *_Nonnull data, size_t bytesWritten, id _Nullable exception)
 A block which is called when data was written asynchronously to a stream. More...
 
typedef OFString *_Nullable(^ of_stream_async_write_string_block_t) (OFString *_Nonnull string, size_t bytesWritten, id _Nullable exception)
 A block which is called when a string was written asynchronously to a stream. More...
 

Typedef Documentation

◆ of_stream_async_read_block_t

typedef bool(^ of_stream_async_read_block_t) (size_t length, id _Nullable exception)

A block which is called when data was read asynchronously from a stream.

Parameters
lengthThe length of the data that has been read
exceptionAn exception which occurred while reading or nil on success
Returns
A bool whether the same block should be used for the next read

◆ of_stream_async_read_line_block_t

typedef bool(^ of_stream_async_read_line_block_t) (OFString *_Nullable line, id _Nullable exception)

A block which is called when a line was read asynchronously from a stream.

Parameters
lineThe line which has been read or nil when the end of stream occurred
exceptionAn exception which occurred while reading or nil on success
Returns
A bool whether the same block should be used for the next read

◆ of_stream_async_write_data_block_t

typedef OFData* _Nullable(^ of_stream_async_write_data_block_t) (OFData *_Nonnull data, size_t bytesWritten, id _Nullable exception)

A block which is called when data was written asynchronously to a stream.

Parameters
dataThe data which was written to the stream
bytesWrittenThe number of bytes which have been written. This matches the length of the specified data on the asynchronous write if no exception was encountered.
exceptionAn exception which occurred while writing or nil on success
Returns
The data to repeat the write with or nil if it should not repeat

◆ of_stream_async_write_string_block_t

typedef OFString* _Nullable(^ of_stream_async_write_string_block_t) (OFString *_Nonnull string, size_t bytesWritten, id _Nullable exception)

A block which is called when a string was written asynchronously to a stream.

Parameters
stringThe string which was written to the stream
bytesWrittenThe number of bytes which have been written. This matches the length of the specified data on the asynchronous write if no exception was encountered.
exceptionAn exception which occurred while writing or nil on success
Returns
The string to repeat the write with or nil if it should not repeat