blackberry.com
BlackBerry Dynamics
Runtime library for iOS applications
from the application developer portal
Public Member Functions

GDDirectByteBuffer Class Reference

Buffer for accessing GDSocket and GDHttpRequest data. More...

#import <GDNETiOS.h>

List of all members.

Public Member Functions


Detailed Description

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.


Member Function Documentation

- (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.

Parameters:
dataNull-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.

Parameters:
dataNSData 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.

Parameters:
dataBuffer containing the data to be appended.
lengthNumber of bytes to be written from the buffer.
- (int) bytesUnread
Returns:
Number of bytes available to read from the buffer.
- (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.

Parameters:
dataPointer to a char buffer to which data is to be written.
maxLengthMaximum number of bytes to be written to the char buffer.
Returns:
Number of bytes actually written to the char buffer.
- (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.

Returns:
New NSString object, populated with data consumed from the buffer.
- (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.

Returns:
New NSData object, populated with data consumed from the buffer.

The documentation for this class was generated from the following file: