BlackBerry Dynamics
Runtime library for macOS applications
from the application developer portal
Public Member Functions

GDCReadStream Class Reference

NSInputStream subclass for reading files that are in the secure store. More...

#import <GDCReadStream.h>

List of all members.

Public Member Functions

Detailed Description

This class is a subclass of the native NSInputStream class, for access to the BlackBerry Dynamics secure file system.

See also:

Programming Interface

This class supports the read and hasBytesAvailable member functions of NSInputStream. This class doesn't support getBuffer, which will always return NO. This class also doesn't support scheduleInRunLoop nor removeFromRunLoop. Support for run loops isn't required because the file data can be read immediately.

This documentation includes only additional operations provided by GDCReadStream that aren't part of NSInputStream.

Notes on use of the read function
The read function in this class will work best when the supplied buffer is a multiple of 16 bytes in length. The maxLength parameter should reflect the size of the buffer, and not the amount of data remaining to be read from the file. To read a particular number of bytes, B, supply a buffer whose size is B rounded up to the next multiple of 16.
The return value of the read function must always be checked by the application. It mustn't be assumed that a file has been completely read into a buffer, even if the buffer is large enough to accomodate the whole file.

The functions in this class utilize NSError in a conventional way. Function calls accept as a parameter the location of a pointer to NSError, i.e. a pointer to a pointer, with type NSError**. The location may be nil. If the location is not nil, and an error occurs, the BlackBerry Dynamics Runtime overwrites the pointer at the specified location with the address of an object that describes the error that occurred.

See also:
NSInputStream class reference on the developer website.

Member Function Documentation

- (instancetype) initWithFile: (NSString *)  filePath
error: (NSError **)  error 

Call this constructor to open a file in the secure store for reading. Files in the secure store are encrypted on the device; this function provides access to decrypted data.

Note. This constructor is used by the getReadStream: function in the GDFileManager class.

filePathNSString containing the path, within the secure store, of the file to be opened.
errorFor returning an NSError object if an error occurs. If nil, no object will be returned.
nil if the file could not be opened.
- (instancetype) initWithFile: (NSString *)  filePath

Calling this constructor is equivalent to calling the initWithFile:error: constructor, above, and specifying nil as the error parameter.

- (BOOL) seekToFileOffset: (unsigned long long)  offset

Call this function to move the file pointer to a specific offset from the start of the stream.

offsetRequired offset, expressed as a number of bytes from the start of the file. Zero means the start of the file.
YES if the file pointer was moved to the required offset.
NO Otherwise.
- (NSError*) streamError

Call this function to get the last error associated with the open stream.

Reference to an NSError object that describes the error.

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