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;
295 @property (readonly, nonatomic, getter=isAtEndOfStream)
bool atEndOfStream;
300 @property (nonatomic)
bool buffersWrites;
305 @property (readonly, nonatomic)
bool hasDataInReadBuffer;
316 @property (nonatomic)
bool canBlock;
324 @property OF_NULLABLE_PROPERTY (assign, nonatomic)
325 id <OFStreamDelegate> delegate;
345 - (size_t)readIntoBuffer: (
void *)buffer length: (
size_t)length;
366 - (void)readIntoBuffer: (
void *)buffer exactLength: (
size_t)length;
368 #ifdef OF_HAVE_SOCKETS 389 - (void)asyncReadIntoBuffer: (
void *)buffer length: (
size_t)length;
412 - (void)asyncReadIntoBuffer: (
void *)buffer
413 length: (
size_t)length
432 - (void)asyncReadIntoBuffer: (
void *)buffer exactLength: (
size_t)length;
451 - (void)asyncReadIntoBuffer: (
void *)buffer
452 exactLength: (
size_t)length
455 # ifdef OF_HAVE_BLOCKS 483 - (void)asyncReadIntoBuffer: (
void *)buffer
484 length: (
size_t)length
486 OF_DEPRECATED(ObjFW, 1, 2,
487 "Use -[asyncReadIntoBuffer:length:handler:] instead");
515 - (void)asyncReadIntoBuffer: (
void *)buffer
516 length: (
size_t)length
547 - (void)asyncReadIntoBuffer: (
void *)buffer
548 length: (
size_t)length
551 OF_DEPRECATED(ObjFW, 1, 2,
552 "Use -[asyncReadIntoBuffer:length:runLoopMode:handler:] instead");
581 - (void)asyncReadIntoBuffer: (
void *)buffer
582 length: (
size_t)length
609 - (void)asyncReadIntoBuffer: (
void *)buffer
610 exactLength: (
size_t)length
612 OF_DEPRECATED(ObjFW, 1, 2,
613 "Use -[asyncReadIntoBuffer:exactLength:handler:] instead");
637 - (void)asyncReadIntoBuffer: (
void *)buffer
638 exactLength: (
size_t)length
666 - (void)asyncReadIntoBuffer: (
void *)buffer
667 exactLength: (
size_t)length
670 OF_DEPRECATED(ObjFW, 1, 2,
671 "Use -[asyncReadIntoBuffer:exactLength:runLoopMode:handler: instead]");
696 - (void)asyncReadIntoBuffer: (
void *)buffer
697 exactLength: (
size_t)length
729 - (uint16_t)readBigEndianInt16;
743 - (uint32_t)readBigEndianInt32;
757 - (uint64_t)readBigEndianInt64;
771 - (float)readBigEndianFloat;
785 - (double)readBigEndianDouble;
799 - (uint16_t)readLittleEndianInt16;
813 - (uint32_t)readLittleEndianInt32;
827 - (uint64_t)readLittleEndianInt64;
841 - (float)readLittleEndianFloat;
855 - (double)readLittleEndianDouble;
871 - (
OFData *)readDataWithCount: (
size_t)count;
888 - (
OFData *)readDataWithItemSize: (
size_t)itemSize count: (
size_t)count;
898 - (
OFData *)readDataUntilEndOfStream;
943 - (
OFString *)readStringWithLength: (
size_t)length;
966 - (
OFString *)readStringWithLength: (
size_t)length
995 #ifdef OF_HAVE_SOCKETS 1003 - (void)asyncReadString;
1036 - (void)asyncReadLine;
1062 # ifdef OF_HAVE_BLOCKS 1130 OF_DEPRECATED(ObjFW, 1, 2, "Use -[asyncReadLineWithHandler:] instead");
1165 OF_DEPRECATED(ObjFW, 1, 2,
1166 "Use -[asyncReadLineWithEncoding:handler:] instead");
1205 OF_DEPRECATED(ObjFW, 1, 2,
1206 "Use -[asyncReadLineWithEncoding:runLoopMode:handler:] instead");
1263 - (nullable
OFString *)tryReadLine;
1349 - (bool)flushWriteBuffer;
1366 - (void)writeBuffer: (const
void *)buffer length: (
size_t)length;
1368 #ifdef OF_HAVE_SOCKETS 1377 - (void)asyncWriteData: (
OFData *)data;
1388 - (void)asyncWriteData: (
OFData *)data
1399 - (void)asyncWriteString: (
OFString *)string;
1412 - (void)asyncWriteString: (
OFString *)string
1427 - (void)asyncWriteString: (
OFString *)string
1431 # ifdef OF_HAVE_BLOCKS 1445 - (void)asyncWriteData: (
OFData *)data
1447 OF_DEPRECATED(ObjFW, 1, 2, "Use -[asyncWriteData:handler:] instead");
1460 - (void)asyncWriteData: (
OFData *)data
1477 - (void)asyncWriteData: (
OFData *)data
1480 OF_DEPRECATED(ObjFW, 1, 2,
1481 "Use -[asyncWriteData:runLoopMode:handler:] instead");
1495 - (void)asyncWriteData: (
OFData *)data
1512 - (void)asyncWriteString: (
OFString *)string
1514 OF_DEPRECATED(ObjFW, 1, 2, "Use -[asyncWriteString:handler:] instead");
1527 - (void)asyncWriteString: (
OFString *)string
1546 - (void)asyncWriteString: (
OFString *)string
1549 OF_DEPRECATED(ObjFW, 1, 2,
1550 "Use -[asyncWriteString:encoding:handler:] instead");
1566 - (void)asyncWriteString: (
OFString *)string
1587 - (void)asyncWriteString: (
OFString *)string
1591 OF_DEPRECATED(ObjFW, 1, 2,
1592 "Use -[asyncWriteString:encoding:runLoopMode:handler:] instead");
1609 - (void)asyncWriteString: (
OFString *)string
1625 - (void)writeInt8: (uint8_t)int8;
1636 - (void)writeBigEndianInt16: (uint16_t)int16;
1647 - (void)writeBigEndianInt32: (uint32_t)int32;
1658 - (void)writeBigEndianInt64: (uint64_t)int64;
1669 - (void)writeBigEndianFloat: (
float)float_;
1680 - (void)writeBigEndianDouble: (
double)double_;
1691 - (void)writeLittleEndianInt16: (uint16_t)int16;
1702 - (void)writeLittleEndianInt32: (uint32_t)int32;
1713 - (void)writeLittleEndianInt64: (uint64_t)int64;
1724 - (void)writeLittleEndianFloat: (
float)float_;
1735 - (void)writeLittleEndianDouble: (
double)double_;
1746 - (void)writeData: (
OFData *)data;
1757 - (void)writeString: (
OFString *)string;
1781 - (void)writeLine: (
OFString *)string;
1827 - (void)writeFormat: (
OFConstantString *)format arguments: (va_list)arguments;
1829 #ifdef OF_HAVE_SOCKETS 1833 - (void)cancelAsyncRequests;
1857 - (void)unreadFromBuffer: (const
void *)buffer length: (
size_t)length;
1882 - (size_t)lowlevelReadIntoBuffer: (
void *)buffer length: (
size_t)length;
1898 - (size_t)lowlevelWriteBuffer: (const
void *)buffer length: (
size_t)length;
1910 - (bool)lowlevelIsAtEndOfStream;
1923 - (bool)lowlevelHasDataInReadBuffer;
1926 OF_ASSUME_NONNULL_END
bool(^ OFStreamAsyncReadBlock)(size_t length, id exception)
A block which is called when data was read asynchronously from a stream.
Definition: OFStream.h:55
OFStringEncoding
The encoding of a string.
Definition: OFString.h:65
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:41
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
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(^ 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(^ 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
A base class for different types of streams.
Definition: OFStream.h:278
A class for handling strings.
Definition: OFString.h:142
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
bool(^ OFStreamAsyncReadLineBlock)(OFString *line, id exception)
A block which is called when a line was read asynchronously from a stream.
Definition: OFStream.h:98
A protocol for the creation of copies.
Definition: OFObject.h:1350
A class for storing arbitrary data in an array.
Definition: OFData.h:45
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