Platforms to show: All Mac Windows Linux Cross-Platform
Back to CFReadStreamMBS class.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Terminates the flow of bytes; releases any system resources required by the stream. The stream may not fail to close.
CFReadStreamMBS.CreateForHTTPRequest(request as CFHTTPMessageMBS) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Creates a read stream for the response to the given request; when the stream is opened, it will begin transmitting the request. The bytes returned are the pure body bytes; the response header has been parsed off. To retrieve the response header, ask for kCFStreamPropertyHTTPResponseHeader any time after the first bytes arrive on the stream (or when stream end is reported, if there are no data bytes).
Returns true if successfull.
Some examples using this method:
CFReadStreamMBS.CreateWithFile(fileurl as CFURLMBS) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true if successfull.
CFReadStreamMBS.CreateWithMemoryBlock(mem as memoryblock, len as Integer) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true if successfull.
CFReadStreamMBS.CreateWithString(s as string) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true if successfull.
CFReadStreamMBS.ErrorCode as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Meaning depends on the ErrorDomain.
CFReadStreamMBS.ErrorDomain as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Possible domains:
kCFStreamErrorDomainCustom | = -1 | custom to the kind of stream in question |
kCFStreamErrorDomainPOSIX | = 1 | POSIX errno; interpret using <sys/errno.h> |
kCFStreamErrorDomainMacOSStatus | = 2 | OSStatus type from Carbon APIs; interpret using <MacTypes.h> |
CFReadStreamMBS.GetProperty(propertyName as CFStringMBS) as CFObjectMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns nil on any error.
Particular streams can name properties and assign meanings to them; you access these properties through the GetProperty and SetProperty calls. A property is any interesting information about the stream other than the data being transmitted itself. Examples include the headers from an HTTP transmission, or the expected number of bytes, or permission information, etc. Properties that can be set configure the behavior of the stream, and may only be settable at particular times (like before the stream has been opened). See the documentation for particular properties to determine their get- and set-ability.
CFReadStreamMBS.HasBytesAvailable as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Whether there is data currently available for reading;
Returns TRUE if it's impossible to tell without trying.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
You need to remove the event handler later to not leak memory!
The event handler is needed to have the Callback event fireing.
CFReadStreamMBS.Open as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns success/failure. Opening a stream causes it to reserve all the system resources it requires. If the stream can open non-blocking, this will always return TRUE; listen to the Callback to find out when the open completes and whether it was successful, or poll using the Status property, waiting for a status of kCFStreamStatusOpen or kCFStreamStatusError.
CFReadStreamMBS.ReadMemory(maxBytesToRead as Integer, mem as memoryblock) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns the number of bytes read, or -1 if an error occurs preventing any bytes from being read, or 0 if the stream's end was encountered.
It is an error to try and read from a stream that hasn't been opened first.
This call will block until at least one byte is available; it will NOT block until the entire buffer can be filled. To avoid blocking, either poll using HasBytesAvailable or use the run loop and listen for the kCFStreamCanRead event for notification of data available.
CFReadStreamMBS.ReadString(maxBytesToRead as Integer) as string
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns a string as long as the number of bytes read, or "" if an error occurs preventing any bytes from being read or the stream's end was encountered.
It is an error to try and read from a stream that hasn't been opened first.
This call will block until at least one byte is available; it will NOT block until the entire buffer can be filled. To avoid blocking, either poll using HasBytesAvailable or use the run loop and listen for the kCFStreamCanRead event for notification of data available.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
You should remove this event handler after you finished with the stream.
CFReadStreamMBS.SetProperty(propertyName as CFStringMBS, propertyValue as CFObjectMBS) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true if successfull.
CFReadStreamMBS.Status as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | CoreFoundation Network | MBS MacCF Plugin | 3.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Possible values:
kCFStreamStatusNotOpen | = 0 |
kCFStreamStatusOpening | = 1 (open is in-progress) |
kCFStreamStatusOpen | = 2 |
kCFStreamStatusReading | = 3 |
kCFStreamStatusWriting | = 4 |
kCFStreamStatusAtEnd | = 5 (no further bytes can be read/written) |
kCFStreamStatusClosed | = 6 |
kCFStreamStatusError | = 7 |
The items on this page are in the following plugins: MBS MacCF Plugin.