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() -> FileManager
Return Value
A non-nil FileManager.
-
Opens an input stream for a file.
Since
since 8.22Declaration
Swift
func inputStreamWithFile(at path: String) -> InputStream?
Parameters
path
Path to the file.
Return Value
An input stream for this file.
-
Writes the contents of a
Data
object to a file.@see Data.write()
Since
since 8.22Declaration
Swift
func write(data: Data, toFile: String, options: Data.WritingOptions) -> Bool
Parameters
data
The
Data
to write.toFile
The file path to which the contents are written.
options
Writing options.
Return Value
Specifies if the write was successful.
-
Gets the contents of a file as a
Data
object.@see
Data.init(contentsOf:)
Since
since 8.22Declaration
Swift
func dataWithContentsOfFile(path: String) -> Data?
Parameters
path
File 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
path
The file path to the file that is read.
encoding
The 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
path
The file path from which the image is read.
Return Value
The image from the file. If the file read was unsuccessful, nil is returned.