RSDDataLogger
open class RSDDataLogger
RSDDataLogger
is used to write data samples using a custom encoding to a logging file.
Note
This class does not use a serial queue to process the samples. It is assumed that the recorder that is using this file will handle that implementation.-
A unique identifier for the logger.
Declaration
Swift
public let identifier: String
-
The url to the file.
Declaration
Swift
public let url: URL
-
Number of samples written to the file.
Declaration
Swift
public private(set) var sampleCount: Int { get }
-
The content type of the data file (if known).
Declaration
Swift
open var contentType: String? { get }
-
Default initializer. The initializer will automatically open the file and write the initial data (if any).
Declaration
Swift
public init(identifier: String, url: URL, initialData: Data?) throws
Parameters
identifier
A unique identifier for the logger.
url
The url to the file.
initialData
The initial data to write to the file on opening.
-
Write data to the logger.
Throws
Error if writing the data fails because the wasn’t enough memory on the device.Declaration
Swift
open func write(_ data: Data) throws
Parameters
data
The data to add to the logging file.
-
Close the file. This will write the end tag for the root element and then close the file handle. If there is an error thrown by writing the closing tag, then the file handle will be closed and the error will be rethrown.
Throws
Error thrown when attempting to write the closing tag.Declaration
Swift
open func close() throws