Platforms to show: All Mac Windows Linux Cross-Platform

Back to CFReadStreamMBS class.

CFReadStreamMBS.close

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation Network MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Closes the stream.

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 new read stream based on the given HTTP request.

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
Creates a new file based readstream.

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
Creates a new readstream based on the data of the given memoryblock.

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
Creates a new readstream based on the data of the given string.

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
The last error code.

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
The error domain of the last error code.

Possible domains:
kCFStreamErrorDomainCustom = -1custom to the kind of stream in question
kCFStreamErrorDomainPOSIX = 1POSIX errno; interpret using <sys/errno.h>
kCFStreamErrorDomainMacOSStatus = 2OSStatus 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 a property of the stream.

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
True if you can read bytes.

Whether there is data currently available for reading;
Returns TRUE if it's impossible to tell without trying.

CFReadStreamMBS.InstallEvents

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation Network MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Installs the event handler.

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
Opens the stream.

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
Reads some bytes from the stream.

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
Reads some bytes from the stream.

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.

CFReadStreamMBS.RemoveEvents

Type Topic Plugin Version macOS Windows Linux iOS Targets
method CoreFoundation Network MBS MacCF Plugin 3.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Removes the event handler.

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
Sets a property of the stream.

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
The status of the stream.

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.


The biggest plugin in space...