BBSWriteStream

public class BBSWriteStream : OutputStream, InitializationStateProvider

Overview

OutputStream subclass for writing files in the secure store.

This class is a subclass of the native OutputStream class, for access to the BlackBerrySecurity secure file system.

Usage

The class supports the write and hasSpaceAvailable member functions of OutputStream. The subclass doesn’t support scheduleInRunLoop nor removeFromRunLoop. Support for run loops isn’t required because the file data can be written immediately.

  • Initializer that opens or creates a file in the secure store, for writing.

    Call this initializer to create a new file in the secure store, or to open an existing file for writing. Files in the secure store are encrypted on the device; data written to the stream returned by this function will be encrypted, transparently to the application.

    If a file already exists at the specified path, the file can either be appended to, or overwritten.

    Declaration

    Swift

    public override init?(url: URL, append shouldAppend: Bool)

    Parameters

    url

    A URL instance representing the path within the secure store to the file to be opened.

    shouldAppend

    Selects the action to take if a file already exists. Pass true to append to the file, or false to overwrite.

    Return Value

    • An instance of BBSWriteStream in case of success
    • nil if the file couldn’t be opened.
  • Initializer that opens or creates a file in the secure store, for writing.

    Call this initializer to create a new file in the secure store, or to open an existing file for writing. Files in the secure store are encrypted on the device; data written to the stream returned by this function will be encrypted, transparently to the application.

    If a file already exists at the specified path, the file can either be appended to, or overwritten.

    Declaration

    Swift

    public init?(path: String, append shouldAppend: Bool) throws

    Parameters

    path

    A string path within the secure store to the file to be opened.

    shouldAppend

    Selects the action to take if a file already exists. Pass true to append to the file, or false to overwrite.

    Return Value

    • An instance of BBSWriteStream in case of success
    • nil if the file couldn’t be opened.