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;
291 uintptr_t _allowsLossyEncoding;
298 @property (readonly, nonatomic, getter=isAtEndOfStream)
bool atEndOfStream;
303 @property (nonatomic)
bool buffersWrites;
308 @property (readonly, nonatomic)
bool hasDataInReadBuffer;
326 @property (nonatomic)
bool allowsLossyEncoding;
337 @property (nonatomic)
bool canBlock;
345 @property OF_NULLABLE_PROPERTY (assign, nonatomic)
346 id <OFStreamDelegate> delegate;
366 - (size_t)readIntoBuffer: (
void *)buffer length: (
size_t)length;
387 - (void)readIntoBuffer: (
void *)buffer exactLength: (
size_t)length;
389 #ifdef OF_HAVE_SOCKETS
410 - (void)asyncReadIntoBuffer: (
void *)buffer length: (
size_t)length;
433 - (void)asyncReadIntoBuffer: (
void *)buffer
434 length: (
size_t)length
453 - (void)asyncReadIntoBuffer: (
void *)buffer exactLength: (
size_t)length;
472 - (void)asyncReadIntoBuffer: (
void *)buffer
473 exactLength: (
size_t)length
476 # ifdef OF_HAVE_BLOCKS
504 - (void)asyncReadIntoBuffer: (
void *)buffer
505 length: (
size_t)length
507 OF_DEPRECATED(ObjFW, 1, 2,
508 "Use -[asyncReadIntoBuffer:length:handler:] instead");
536 - (void)asyncReadIntoBuffer: (
void *)buffer
537 length: (
size_t)length
568 - (void)asyncReadIntoBuffer: (
void *)buffer
569 length: (
size_t)length
572 OF_DEPRECATED(ObjFW, 1, 2,
573 "Use -[asyncReadIntoBuffer:length:runLoopMode:handler:] instead");
602 - (void)asyncReadIntoBuffer: (
void *)buffer
603 length: (
size_t)length
630 - (void)asyncReadIntoBuffer: (
void *)buffer
631 exactLength: (
size_t)length
633 OF_DEPRECATED(ObjFW, 1, 2,
634 "Use -[asyncReadIntoBuffer:exactLength:handler:] instead");
658 - (void)asyncReadIntoBuffer: (
void *)buffer
659 exactLength: (
size_t)length
687 - (void)asyncReadIntoBuffer: (
void *)buffer
688 exactLength: (
size_t)length
691 OF_DEPRECATED(ObjFW, 1, 2,
692 "Use -[asyncReadIntoBuffer:exactLength:runLoopMode:handler: instead]");
717 - (void)asyncReadIntoBuffer: (
void *)buffer
718 exactLength: (
size_t)length
750 - (uint16_t)readBigEndianInt16;
764 - (uint32_t)readBigEndianInt32;
778 - (uint64_t)readBigEndianInt64;
792 - (float)readBigEndianFloat;
806 - (double)readBigEndianDouble;
820 - (uint16_t)readLittleEndianInt16;
834 - (uint32_t)readLittleEndianInt32;
848 - (uint64_t)readLittleEndianInt64;
862 - (float)readLittleEndianFloat;
876 - (double)readLittleEndianDouble;
892 - (
OFData *)readDataWithCount: (
size_t)count;
909 - (
OFData *)readDataWithItemSize: (
size_t)itemSize count: (
size_t)count;
919 - (
OFData *)readDataUntilEndOfStream;
964 - (
OFString *)readStringWithLength: (
size_t)length;
987 - (
OFString *)readStringWithLength: (
size_t)length
1016 #ifdef OF_HAVE_SOCKETS
1024 - (void)asyncReadString;
1057 - (void)asyncReadLine;
1083 # ifdef OF_HAVE_BLOCKS
1151 OF_DEPRECATED(ObjFW, 1, 2, "Use -[asyncReadLineWithHandler:] instead");
1186 OF_DEPRECATED(ObjFW, 1, 2,
1187 "Use -[asyncReadLineWithEncoding:handler:] instead");
1226 OF_DEPRECATED(ObjFW, 1, 2,
1227 "Use -[asyncReadLineWithEncoding:runLoopMode:handler:] instead");
1284 - (nullable
OFString *)tryReadLine;
1370 - (bool)flushWriteBuffer;
1387 - (void)writeBuffer: (const
void *)buffer length: (
size_t)length;
1389 #ifdef OF_HAVE_SOCKETS
1398 - (void)asyncWriteData: (
OFData *)data;
1409 - (void)asyncWriteData: (
OFData *)data
1420 - (void)asyncWriteString: (
OFString *)string;
1433 - (void)asyncWriteString: (
OFString *)string
1448 - (void)asyncWriteString: (
OFString *)string
1452 # ifdef OF_HAVE_BLOCKS
1466 - (void)asyncWriteData: (
OFData *)data
1468 OF_DEPRECATED(ObjFW, 1, 2, "Use -[asyncWriteData:handler:] instead");
1481 - (void)asyncWriteData: (
OFData *)data
1498 - (void)asyncWriteData: (
OFData *)data
1501 OF_DEPRECATED(ObjFW, 1, 2,
1502 "Use -[asyncWriteData:runLoopMode:handler:] instead");
1516 - (void)asyncWriteData: (
OFData *)data
1533 - (void)asyncWriteString: (
OFString *)string
1535 OF_DEPRECATED(ObjFW, 1, 2, "Use -[asyncWriteString:handler:] instead");
1548 - (void)asyncWriteString: (
OFString *)string
1567 - (void)asyncWriteString: (
OFString *)string
1570 OF_DEPRECATED(ObjFW, 1, 2,
1571 "Use -[asyncWriteString:encoding:handler:] instead");
1587 - (void)asyncWriteString: (
OFString *)string
1608 - (void)asyncWriteString: (
OFString *)string
1612 OF_DEPRECATED(ObjFW, 1, 2,
1613 "Use -[asyncWriteString:encoding:runLoopMode:handler:] instead");
1630 - (void)asyncWriteString: (
OFString *)string
1646 - (void)writeInt8: (uint8_t)int8;
1657 - (void)writeBigEndianInt16: (uint16_t)int16;
1668 - (void)writeBigEndianInt32: (uint32_t)int32;
1679 - (void)writeBigEndianInt64: (uint64_t)int64;
1690 - (void)writeBigEndianFloat: (
float)float_;
1701 - (void)writeBigEndianDouble: (
double)double_;
1712 - (void)writeLittleEndianInt16: (uint16_t)int16;
1723 - (void)writeLittleEndianInt32: (uint32_t)int32;
1734 - (void)writeLittleEndianInt64: (uint64_t)int64;
1745 - (void)writeLittleEndianFloat: (
float)float_;
1756 - (void)writeLittleEndianDouble: (
double)double_;
1767 - (void)writeData: (
OFData *)data;
1778 - (void)writeString: (
OFString *)string;
1802 - (void)writeLine: (
OFString *)string;
1848 - (void)writeFormat: (
OFConstantString *)format arguments: (va_list)arguments;
1850 #ifdef OF_HAVE_SOCKETS
1854 - (void)cancelAsyncRequests;
1878 - (void)unreadFromBuffer: (const
void *)buffer length: (
size_t)length;
1903 - (size_t)lowlevelReadIntoBuffer: (
void *)buffer length: (
size_t)length;
1919 - (size_t)lowlevelWriteBuffer: (const
void *)buffer length: (
size_t)length;
1931 - (bool)lowlevelIsAtEndOfStream;
1944 - (bool)lowlevelHasDataInReadBuffer;
1947 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:956
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:1618
Definition: OFStream.h:176