FileHandleDataSource
FileSoure getting data using a Swift FileHandle.
Fields
privateMeta
Declared private (to be encrypted) metadata of the File
public var privateMeta: Data
publicMeta
Declared public metadata of the File
public var publicMeta: Data
size
Declared size of the File
public var size: Int64
hasDataLeft
Signifies that there are still bytes that have not been retrieved
public private(set) var hasDataLeft: Bool = true
Methods
init(file:privateMeta:publicMeta:size:hasDataLeft:)
public init(
file: FileHandle,
privateMeta: Data,
publicMeta: Data,
size: Int64,
hasDataLeft: Bool
)
Name | Type | Description |
---|---|---|
file | FileHandle | |
privateMeta | Data | |
publicMeta | Data | |
size | Int64 | |
hasDataLeft | Bool |
getNextChunk(ofSize:)
Retrieves up to chunkSize
bytes from the data source.
public mutating func getNextChunk(
ofSize chunkSize: Int64
) throws -> Data
Name | Type | Description |
---|---|---|
chunkSize | Int64 | the size of a chunk to retrieve from the source |
Type | Description |
---|---|
Data | next `chunkSize` bytes from the source |
close()
Attempts to close the data source. Calling this method makes sense if the source is a file on disc.
public mutating func close(
) throws -> Void