• BlackBerry Dynamics
  • Runtime library for iOS applications
  • 12.0.1.79
GDCReadStream Class Reference

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

#import <BlackBerryDynamics/GD/GDCReadStream.h>

Inheritance diagram for GDCReadStream:

Description

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

See also
GDFileManager
GDFileHandle

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 isn't 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 apple.com developer website.
GDCWriteStream

Instance Methods

(instancetype) - initWithFile:error:
 Constructor that opens a file in the secure store, for reading. More...
 
(instancetype) - initWithFile:
 Constructor that opens a file in the secure store, for reading. More...
 
(BOOL) - seekToFileOffset:
 Seek in an open file in the secure file system. More...
 
(NSError *) - streamError
 Get the last error. More...
 

Method Documentation

◆ initWithFile:error:

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

Parameters
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.
Returns
nil if the file could not be opened.

◆ initWithFile:

- (instancetype) initWithFile: (NSString *)  filePath

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

◆ seekToFileOffset:

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

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

Parameters
offsetRequired offset, expressed as a number of bytes from the start of the file. Zero means the start of the file.
Returns
YES if the file pointer was moved to the required offset.
NO Otherwise.

◆ streamError

- (NSError*) streamError

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

Returns
Reference to an NSError object that describes the error.
See also
GDFileManager Error Domain

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