SASFileSystemDelegate
@objc
public protocol SASFileSystemDelegate
IO definition for the SASManager.
This interface defines the File IO for the SASManager. All file input and
output goes through these calls. User applications can override this delegate
via SASManagerDelegate.getFileSystemDelegate().
Since
since 8.22-
Provides a FileSystemManager to the SASManager for FileIO.
In the default implementation, this will return FileManager.shared.
Since
since 8.22Declaration
Swift
func defaultFileManager() -> FileManagerReturn Value
A non-nil FileManager.
-
Opens an input stream for a file.
Since
since 8.22Declaration
Swift
func inputStreamWithFile(at path: String) -> InputStream?Parameters
pathPath to the file.
Return Value
An input stream for this file.
-
Writes the contents of a
Dataobject to a file.@see Data.write()
Since
since 8.22Declaration
Swift
func write(data: Data, toFile: String, options: Data.WritingOptions) -> BoolParameters
dataThe
Datato write.toFileThe file path to which the contents are written.
optionsWriting options.
Return Value
Specifies if the write was successful.
-
Gets the contents of a file as a
Dataobject.@see
Data.init(contentsOf:)Since
since 8.22Declaration
Swift
func dataWithContentsOfFile(path: String) -> Data?Parameters
pathFile path to the file to read.
Return Value
The data with the contents of the file. If the file read was unsuccessful, nil is returned.
-
Gets the contents of a file as a
String.See
see
String.init(contentsOfFile:encoding:)Since
since 8.22
Declaration
Swift
func stringWithContentsOfFile(path: String, encoding: UInt) -> String?Parameters
pathThe file path to the file that is read.
encodingThe encoding to use.
Return Value
The string contents of the file. If the file read was usuccessful, nil is returned.
-
Gets the contents of a file as an image.
See
seeUIImage.init(contentsOfFile:)Since
since 8.22Declaration
Swift
func imageWithContentsOfFile(path: String) -> UIImage?Parameters
pathThe file path from which the image is read.
Return Value
The image from the file. If the file read was unsuccessful, nil is returned.
View on GitHub
SASFileSystemDelegate Protocol Reference