20 #ifndef __STDC_LIMIT_MACROS
21 # define __STDC_LIMIT_MACROS
23 #ifndef __STDC_CONSTANT_MACROS
24 # define __STDC_CONSTANT_MACROS
32 #ifdef OF_HAVE_SOCKETS
33 # import "OFKernelEventObserver.h"
36 OF_ASSUME_NONNULL_BEGIN
43 #if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_BLOCKS)
56 OF_DEPRECATED(ObjFW, 1, 2,
"Use OFStreamReadHandler instead");
70 size_t length,
id _Nullable exception);
84 OFString *_Nullable string,
id _Nullable exception);
99 id _Nullable exception)
100 OF_DEPRECATED(ObjFW, 1, 2,
"Use OFStreamStringReadHandler instead");
116 id _Nullable exception)
117 OF_DEPRECATED(ObjFW, 1, 2,
"Use OFStreamDataWrittenHandler instead");
133 OFData *data,
size_t bytesWritten,
id _Nullable exception);
149 size_t bytesWritten,
id _Nullable exception)
150 OF_DEPRECATED(ObjFW, 1, 2,
"Use OFStreamStringWrittenHandler instead");
168 id _Nullable exception);
189 didReadIntoBuffer: (
void *)buffer
190 length: (
size_t)length
191 exception: (nullable
id)exception;
204 didReadString: (nullable
OFString *)string
205 exception: (nullable
id)exception;
218 didReadLine: (nullable
OFString *)line
219 exception: (nullable
id)exception;
234 didWriteData: (
OFData *)data
235 bytesWritten: (
size_t)bytesWritten
236 exception: (nullable
id)exception;
254 bytesWritten: (
size_t)bytesWritten
255 exception: (nullable
id)exception;
281 id _Nullable _delegate;
282 #ifndef OF_SEEKABLE_STREAM_M
285 char *_Nullable _readBuffer, *_Nullable _readBufferMemory;
286 char *_Nullable _writeBuffer;
287 size_t _readBufferLength, _writeBufferLength;
288 bool _buffersWrites, _waitingForDelimiter;
297 @property (readonly, nonatomic, getter=isAtEndOfStream)
bool atEndOfStream;
302 @property (nonatomic)
bool buffersWrites;
307 @property (readonly, nonatomic)
bool hasDataInReadBuffer;
326 @property (nonatomic)
bool canBlock;
334 @property OF_NULLABLE_PROPERTY (assign, nonatomic)
335 id <OFStreamDelegate> delegate;
355 - (size_t)readIntoBuffer: (
void *)buffer length: (
size_t)length;
376 - (void)readIntoBuffer: (
void *)buffer exactLength: (
size_t)length;
378 #ifdef OF_HAVE_SOCKETS
399 - (void)asyncReadIntoBuffer: (
void *)buffer length: (
size_t)length;
422 - (void)asyncReadIntoBuffer: (
void *)buffer
423 length: (
size_t)length
442 - (void)asyncReadIntoBuffer: (
void *)buffer exactLength: (
size_t)length;
461 - (void)asyncReadIntoBuffer: (
void *)buffer
462 exactLength: (
size_t)length
465 # ifdef OF_HAVE_BLOCKS
493 - (void)asyncReadIntoBuffer: (
void *)buffer
494 length: (
size_t)length
496 OF_DEPRECATED(ObjFW, 1, 2,
497 "Use -[asyncReadIntoBuffer:length:handler:] instead");
525 - (void)asyncReadIntoBuffer: (
void *)buffer
526 length: (
size_t)length
557 - (void)asyncReadIntoBuffer: (
void *)buffer
558 length: (
size_t)length
561 OF_DEPRECATED(ObjFW, 1, 2,
562 "Use -[asyncReadIntoBuffer:length:runLoopMode:handler:] instead");
591 - (void)asyncReadIntoBuffer: (
void *)buffer
592 length: (
size_t)length
619 - (void)asyncReadIntoBuffer: (
void *)buffer
620 exactLength: (
size_t)length
622 OF_DEPRECATED(ObjFW, 1, 2,
623 "Use -[asyncReadIntoBuffer:exactLength:handler:] instead");
647 - (void)asyncReadIntoBuffer: (
void *)buffer
648 exactLength: (
size_t)length
676 - (void)asyncReadIntoBuffer: (
void *)buffer
677 exactLength: (
size_t)length
680 OF_DEPRECATED(ObjFW, 1, 2,
681 "Use -[asyncReadIntoBuffer:exactLength:runLoopMode:handler: instead]");
706 - (void)asyncReadIntoBuffer: (
void *)buffer
707 exactLength: (
size_t)length
739 - (uint16_t)readBigEndianInt16;
753 - (uint32_t)readBigEndianInt32;
767 - (uint64_t)readBigEndianInt64;
781 - (float)readBigEndianFloat;
795 - (double)readBigEndianDouble;
809 - (uint16_t)readLittleEndianInt16;
823 - (uint32_t)readLittleEndianInt32;
837 - (uint64_t)readLittleEndianInt64;
851 - (float)readLittleEndianFloat;
865 - (double)readLittleEndianDouble;
881 - (
OFData *)readDataWithCount: (
size_t)count;
898 - (
OFData *)readDataWithItemSize: (
size_t)itemSize count: (
size_t)count;
908 - (
OFData *)readDataUntilEndOfStream;
953 - (
OFString *)readStringWithLength: (
size_t)length;
976 - (
OFString *)readStringWithLength: (
size_t)length
1005 #ifdef OF_HAVE_SOCKETS
1013 - (void)asyncReadString;
1046 - (void)asyncReadLine;
1072 # ifdef OF_HAVE_BLOCKS
1140 OF_DEPRECATED(ObjFW, 1, 2, "Use -[asyncReadLineWithHandler:] instead");
1175 OF_DEPRECATED(ObjFW, 1, 2,
1176 "Use -[asyncReadLineWithEncoding:handler:] instead");
1215 OF_DEPRECATED(ObjFW, 1, 2,
1216 "Use -[asyncReadLineWithEncoding:runLoopMode:handler:] instead");
1273 - (nullable
OFString *)tryReadLine;
1359 - (bool)flushWriteBuffer;
1376 - (void)writeBuffer: (const
void *)buffer length: (
size_t)length;
1378 #ifdef OF_HAVE_SOCKETS
1387 - (void)asyncWriteData: (
OFData *)data;
1398 - (void)asyncWriteData: (
OFData *)data
1409 - (void)asyncWriteString: (
OFString *)string;
1422 - (void)asyncWriteString: (
OFString *)string
1437 - (void)asyncWriteString: (
OFString *)string
1441 # ifdef OF_HAVE_BLOCKS
1455 - (void)asyncWriteData: (
OFData *)data
1457 OF_DEPRECATED(ObjFW, 1, 2, "Use -[asyncWriteData:handler:] instead");
1470 - (void)asyncWriteData: (
OFData *)data
1487 - (void)asyncWriteData: (
OFData *)data
1490 OF_DEPRECATED(ObjFW, 1, 2,
1491 "Use -[asyncWriteData:runLoopMode:handler:] instead");
1505 - (void)asyncWriteData: (
OFData *)data
1522 - (void)asyncWriteString: (
OFString *)string
1524 OF_DEPRECATED(ObjFW, 1, 2, "Use -[asyncWriteString:handler:] instead");
1537 - (void)asyncWriteString: (
OFString *)string
1556 - (void)asyncWriteString: (
OFString *)string
1559 OF_DEPRECATED(ObjFW, 1, 2,
1560 "Use -[asyncWriteString:encoding:handler:] instead");
1576 - (void)asyncWriteString: (
OFString *)string
1597 - (void)asyncWriteString: (
OFString *)string
1601 OF_DEPRECATED(ObjFW, 1, 2,
1602 "Use -[asyncWriteString:encoding:runLoopMode:handler:] instead");
1619 - (void)asyncWriteString: (
OFString *)string
1635 - (void)writeInt8: (uint8_t)int8;
1646 - (void)writeBigEndianInt16: (uint16_t)int16;
1657 - (void)writeBigEndianInt32: (uint32_t)int32;
1668 - (void)writeBigEndianInt64: (uint64_t)int64;
1679 - (void)writeBigEndianFloat: (
float)float_;
1690 - (void)writeBigEndianDouble: (
double)double_;
1701 - (void)writeLittleEndianInt16: (uint16_t)int16;
1712 - (void)writeLittleEndianInt32: (uint32_t)int32;
1723 - (void)writeLittleEndianInt64: (uint64_t)int64;
1734 - (void)writeLittleEndianFloat: (
float)float_;
1745 - (void)writeLittleEndianDouble: (
double)double_;
1756 - (void)writeData: (
OFData *)data;
1767 - (void)writeString: (
OFString *)string;
1791 - (void)writeLine: (
OFString *)string;
1837 - (void)writeFormat: (
OFConstantString *)format arguments: (va_list)arguments;
1839 #ifdef OF_HAVE_SOCKETS
1843 - (void)cancelAsyncRequests;
1867 - (void)unreadFromBuffer: (const
void *)buffer length: (
size_t)length;
1892 - (size_t)lowlevelReadIntoBuffer: (
void *)buffer length: (
size_t)length;
1908 - (size_t)lowlevelWriteBuffer: (const
void *)buffer length: (
size_t)length;
1920 - (bool)lowlevelIsAtEndOfStream;
1933 - (bool)lowlevelHasDataInReadBuffer;
1936 OF_ASSUME_NONNULL_END
OFData *(^ OFStreamDataWrittenHandler)(OFStream *stream, OFData *data, size_t bytesWritten, id exception)
A handler which is called when data was written asynchronously to a stream.
Definition: OFStream.h:132
bool(^ OFStreamReadHandler)(OFStream *stream, void *buffer, size_t length, id exception)
A handler which is called when data was read asynchronously from a stream.
Definition: OFStream.h:69
bool(^ OFStreamAsyncReadBlock)(size_t length, id exception)
A block which is called when data was read asynchronously from a stream.
Definition: OFStream.h:55
OFString *(^ OFStreamAsyncWriteStringBlock)(size_t bytesWritten, id exception)
A block which is called when a string was written asynchronously to a stream.
Definition: OFStream.h:148
bool(^ OFStreamAsyncReadLineBlock)(OFString *line, id exception)
A block which is called when a line was read asynchronously from a stream.
Definition: OFStream.h:98
bool(^ OFStreamStringReadHandler)(OFStream *stream, OFString *string, id exception)
A block which is called when a string was read asynchronously from a stream.
Definition: OFStream.h:83
OFData *(^ OFStreamAsyncWriteDataBlock)(size_t bytesWritten, id exception)
A block which is called when data was written asynchronously to a stream.
Definition: OFStream.h:115
OFString *(^ OFStreamStringWrittenHandler)(OFStream *stream, OFString *string, OFStringEncoding encoding, size_t bytesWritten, id exception)
A handler which is called when a string was written asynchronously to a stream.
Definition: OFStream.h:166
OFStringEncoding
The encoding of a string.
Definition: OFString.h:65
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:42
A class for storing arbitrary data in an array.
Definition: OFData.h:46
The root class for all other classes inside ObjFW.
Definition: OFObject.h:922
A base class for different types of streams.
Definition: OFStream.h:280
A class for handling strings.
Definition: OFString.h:143
A protocol for the creation of copies.
Definition: OFObject.h:1584
Definition: OFStream.h:176