Skip to main content

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
)

NameTypeDescription
fileFileHandle
privateMetaData
publicMetaData
sizeInt64
hasDataLeftBool

getNextChunk(ofSize:)

Retrieves up to chunkSizebytes from the data source.

public mutating func getNextChunk(
ofSize chunkSize: Int64
) throws -> Data

NameTypeDescription
chunkSizeInt64the size of a chunk to retrieve from the source

TypeDescription
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