Buffer for accessing GDSocket and GDHttpRequest data. More...
#import <BlackBerryDynamics/GD/GDNETiOS.h>
The BlackBerry Dynamics direct byte buffer interface is used to access a number of in-memory byte buffers within the BlackBerry Dynamics secure communication features.
Instance Methods | |
(instancetype) | - init |
Constructor that prepares a new buffer. More... | |
(void) | - write: |
Append null-terminated string. More... | |
(void) | - writeData: |
Append NSData data. More... | |
(void) | - write:withLength: |
Append a number of bytes from a string. More... | |
(int) | - bytesUnread |
Number of bytes available. More... | |
(int) | - read:toMaxLength: |
Consume data into a char* buffer. More... | |
(nullable NSMutableString *) | - unreadDataAsString |
Consume data into a new NSString object. More... | |
(nullable NSMutableData *) | - unreadData |
Consume data into a new NSData object. More... | |
- (instancetype) init |
Call this function to construct a stand-alone byte buffer. Where a buffer is associated with a GDSocket or GDHttpRequest (deprecated) object, this function will have been called by the BlackBerry Dynamics runtime, and need not be called by the application.
- (void) write: | (const char *) | data |
Call this function to append data to the buffer. This would be used on the outbound buffer of a GDSocket.
Calling this function doesn't cause data to be sent. See write (GDSocket). The buffer allocates itself more memory as necessary to accomodate unsent data.
data | Null-terminated string, containing the data to be appended. The terminating null is not written to the buffer. |
- (void) writeData: | (NSData *) | data |
Call this function to append data to the buffer. This would be used on the outbound buffer of a GDSocket.
Calling this function doesn't cause data to be sent. See write (GDSocket). The buffer allocates itself more memory as necessary to accomodate unsent data.
data | NSData object containing the data to be appended. |
- (void) write: | (const char *) | data | |
withLength: | (int) | length | |
Call this function to append data to the buffer. This would be used on the outbound buffer of a GDSocket.
Calling this function doesn't cause data to be sent. See write (GDSocket). The buffer allocates itself more memory as necessary to accomodate unsent data.
data | Buffer containing the data to be appended. |
length | Number of bytes to be written from the buffer. |
- (int) bytesUnread |
- (int) read: | (char *) | data | |
toMaxLength: | (int) | maxLength | |
Call this function to read and consume a specified amount of raw data from the buffer. This would be used on the inbound buffer of a GDSocket, or on the response data of a GDHttpRequest (deprecated).
This function would typically be called in a delegated event handler, such as one of the following.
Calling this function causes data to be written to a char
buffer supplied by the caller. The caller specifies the maximum amount of data to be written to the buffer, as a number of bytes.
The function returns the number of bytes actually written. This will be the lesser of the specified maximum, and the amount of unread data available.
The data written to the caller's buffer is, in effect, deleted from the byte buffer, and will not be returned by future calls to any reading functions.
data | Pointer to a char buffer to which data is to be written. |
maxLength | Maximum number of bytes to be written to the char buffer. |
char
buffer. - (nullable NSMutableString*) unreadDataAsString |
Call this function to create an NSString
object, populated with data consumed from the buffer. This would be used on the inbound buffer of a GDSocket, or on the response data of a GDHttpRequest (deprecated).
This function would typically be called in a delegated event handler, such as one of the following.
Calling this function first causes a UTF-8 NSString
object to be allocated, by the BlackBerry Dynamics runtime. All unread data from the buffer is then written into the new object. The data written is, in effect, deleted from the buffer, and will not be returned by future calls to any reading functions.
NSString
object, populated with data consumed from the buffer. - (nullable NSMutableData*) unreadData |
Call this function to create an NSData
object, populated with data consumed from the buffer. This would be used on the inbound buffer of a GDSocket, or on the response data of a GDHttpRequest (deprecated).
This function would typically be called in a delegated event handler, such as one of the following.
Calling this function first causes an NSData
object to be allocated, by the BlackBerry Dynamics runtime. All unread data from the buffer is then written into the new object. The data written is, in effect, deleted from the buffer, and will not be returned by future calls to any reading functions.
NSData
object, populated with data consumed from the buffer.