17 #ifndef __STDC_LIMIT_MACROS
18 # define __STDC_LIMIT_MACROS
20 #ifndef __STDC_CONSTANT_MACROS
21 # define __STDC_CONSTANT_MACROS
28 #ifdef OF_HAVE_SOCKETS
29 # import "OFKernelEventObserver.h"
32 OF_ASSUME_NONNULL_BEGIN
40 #if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_BLOCKS)
87 #ifdef OF_HAVE_SOCKETS
92 #if !defined(OF_SEEKABLE_STREAM_M) && !defined(OF_TCP_SOCKET_M)
95 char *_readBuffer, *_writeBuffer;
96 size_t _readBufferLength, _writeBufferLength;
97 bool _writeBuffered, _waitingForDelimiter;
102 #ifdef OF_HAVE_PROPERTIES
103 @property (getter=isWriteBuffered)
bool writeBuffered;
104 @property (getter=isBlocking)
bool blocking;
105 @property (readonly, getter=isAtEndOfStream)
bool atEndOfStream;
113 - (bool)isAtEndOfStream;
129 - (size_t)readIntoBuffer: (
void*)buffer
130 length: (
size_t)length;
147 - (void)readIntoBuffer: (
void*)buffer
148 exactLength: (
size_t)length;
150 #ifdef OF_HAVE_SOCKETS
178 - (void)asyncReadIntoBuffer: (
void*)buffer
179 length: (
size_t)length
181 selector: (
SEL)selector;
208 - (void)asyncReadIntoBuffer: (
void*)buffer
209 exactLength: (
size_t)length
211 selector: (
SEL)selector;
213 # ifdef OF_HAVE_BLOCKS
237 - (void)asyncReadIntoBuffer: (
void*)buffer
238 length: (
size_t)length
262 - (void)asyncReadIntoBuffer: (
void*)buffer
263 exactLength: (
size_t)length
286 - (uint16_t)readBigEndianInt16;
296 - (uint32_t)readBigEndianInt32;
306 - (uint64_t)readBigEndianInt64;
316 - (float)readBigEndianFloat;
326 - (double)readBigEndianDouble;
340 - (size_t)readBigEndianInt16sIntoBuffer: (uint16_t*)buffer
341 count: (
size_t)count;
355 - (size_t)readBigEndianInt32sIntoBuffer: (uint32_t*)buffer
356 count: (
size_t)count;
370 - (size_t)readBigEndianInt64sIntoBuffer: (uint64_t*)buffer
371 count: (
size_t)count;
385 - (size_t)readBigEndianFloatsIntoBuffer: (
float*)buffer
386 count: (
size_t)count;
400 - (size_t)readBigEndianDoublesIntoBuffer: (
double*)buffer
401 count: (
size_t)count;
411 - (uint16_t)readLittleEndianInt16;
421 - (uint32_t)readLittleEndianInt32;
431 - (uint64_t)readLittleEndianInt64;
441 - (float)readLittleEndianFloat;
451 - (double)readLittleEndianDouble;
465 - (size_t)readLittleEndianInt16sIntoBuffer: (uint16_t*)buffer
466 count: (
size_t)count;
480 - (size_t)readLittleEndianInt32sIntoBuffer: (uint32_t*)buffer
481 count: (
size_t)count;
495 - (size_t)readLittleEndianInt64sIntoBuffer: (uint64_t*)buffer
496 count: (
size_t)count;
510 - (size_t)readLittleEndianFloatsIntoBuffer: (
float*)buffer
511 count: (
size_t)count;
525 - (size_t)readLittleEndianDoublesIntoBuffer: (
double*)buffer
526 count: (
size_t)count;
538 - (
OFDataArray*)readDataArrayWithCount: (
size_t)count;
551 - (
OFDataArray*)readDataArrayWithItemSize: (
size_t)itemSize
552 count: (
size_t)count;
576 - (
OFString*)readStringWithLength: (
size_t)length;
593 - (
OFString*)readStringWithLength: (
size_t)length
614 #ifdef OF_HAVE_SOCKETS
631 - (void)asyncReadLineWithTarget: (
id)target
632 selector: (
SEL)selector;
653 selector: (
SEL)selector;
655 # ifdef OF_HAVE_BLOCKS
761 - (bool)isWriteBuffered;
768 - (void)setWriteBuffered: (
bool)enable;
773 - (void)flushWriteBuffer;
781 - (void)writeBuffer: (const
void*)buffer
782 length: (
size_t)length;
789 - (void)writeInt8: (uint8_t)int8;
796 - (void)writeBigEndianInt16: (uint16_t)int16;
803 - (void)writeBigEndianInt32: (uint32_t)int32;
810 - (void)writeBigEndianInt64: (uint64_t)int64;
817 - (void)writeBigEndianFloat: (
float)float_;
824 - (void)writeBigEndianDouble: (
double)double_;
835 - (size_t)writeBigEndianInt16s: (const uint16_t*)buffer
836 count: (
size_t)count;
847 - (size_t)writeBigEndianInt32s: (const uint32_t*)buffer
848 count: (
size_t)count;
859 - (size_t)writeBigEndianInt64s: (const uint64_t*)buffer
860 count: (
size_t)count;
871 - (size_t)writeBigEndianFloats: (const
float*)buffer
872 count: (
size_t)count;
883 - (size_t)writeBigEndianDoubles: (const
double*)buffer
884 count: (
size_t)count;
891 - (void)writeLittleEndianInt16: (uint16_t)int16;
898 - (void)writeLittleEndianInt32: (uint32_t)int32;
905 - (void)writeLittleEndianInt64: (uint64_t)int64;
912 - (void)writeLittleEndianFloat: (
float)float_;
919 - (void)writeLittleEndianDouble: (
double)double_;
930 - (size_t)writeLittleEndianInt16s: (const uint16_t*)buffer
931 count: (
size_t)count;
942 - (size_t)writeLittleEndianInt32s: (const uint32_t*)buffer
943 count: (
size_t)count;
954 - (size_t)writeLittleEndianInt64s: (const uint64_t*)buffer
955 count: (
size_t)count;
966 - (size_t)writeLittleEndianFloats: (const
float*)buffer
967 count: (
size_t)count;
978 - (size_t)writeLittleEndianDoubles: (const
double*)buffer
979 count: (
size_t)count;
995 - (size_t)writeString: (
OFString*)string;
1005 - (size_t)writeString: (
OFString*)string
1014 - (size_t)writeLine: (
OFString*)string;
1024 - (size_t)writeLine: (
OFString*)string
1049 arguments: (va_list)arguments;
1056 - (bool)hasDataInReadBuffer;
1073 - (void)setBlocking: (
bool)enable;
1080 - (int)fileDescriptorForReading;
1087 - (int)fileDescriptorForWriting;
1089 #ifdef OF_HAVE_SOCKETS
1099 - (void)cancelAsyncRequests;
1123 - (void)unreadFromBuffer: (const
void*)buffer
1124 length: (
size_t)length;
1142 - (size_t)lowlevelReadIntoBuffer: (
void*)buffer
1143 length: (
size_t)length;
1155 - (void)lowlevelWriteBuffer: (const
void*)buffer
1156 length: (
size_t)length;
1168 - (bool)lowlevelIsAtEndOfStream;
1171 OF_ASSUME_NONNULL_END
This protocol is implemented by classes which can be observed for readiness for reading by OFKernelEv...
Definition: OFKernelEventObserver.h:73
of_string_encoding_t
The encoding of a string.
Definition: OFString.h:50
bool(^ of_stream_async_read_block_t)(OFStream *stream, void *buffer, size_t length, OFException *OF_NULLABLE exception)
A block which is called when data was read from the stream.
Definition: OFStream.h:50
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:37
The root class for all other classes inside ObjFW.
Definition: OFObject.h:364
A base class for different types of streams.
Definition: OFStream.h:86
bool(^ of_stream_async_read_line_block_t)(OFStream *stream, OFString *OF_NULLABLE line, OFException *OF_NULLABLE exception)
A block which is called when a line was read from the stream.
Definition: OFStream.h:62
A class for handling strings.
Definition: OFString.h:91
A class for storing arbitrary data in an array.
Definition: OFDataArray.h:37
The base class for all exceptions in ObjFW.
Definition: OFException.h:144
This protocol is implemented by classes which can be observed for readiness for writing by OFKernelEv...
Definition: OFKernelEventObserver.h:91
A protocol for the creation of copies.
Definition: OFObject.h:896