Mobile API Reference
MicroStrategy 2019
|
#import <FileManager.h>
Class Methods | |
(id< FileManager >) | + fileManager |
- (NSInteger) appendData: | (NSData *) | data | |
atPath: | (NSString *) | path | |
error: | (NSError **) | error | |
- (NSInteger) appendDataWithNoProtection: | (NSData *) | data | |
atPath: | (NSString *) | path | |
error: | (NSError **) | error | |
encrypt: | (bool) | encrypt | |
- (NSDictionary *) attributesOfItemAtPath: | (NSString *) | path | |
error: | (NSError **) | error | |
Get the attributes for a specific file.
path | the path of the file. |
error | out-parameter to tell whether there is any error occurred. |
- (NSString*) cachesDirectory |
- (void) clearTmpDirectory |
Clear the Tmp directory.
- (NSArray*) contentsOfDirectoryAtPath: | (NSString *) | path | |
error: | (NSError **) | error | |
Returns the contents of a directory at path.
path | the path of the directory. |
error | the error occurred while creating directory. |
- (NSInteger) copyItemAtPath: | (NSString *) | path | |
toPath: | (NSString *) | toPath | |
error: | (NSError **) | error | |
- (BOOL) createDirectoryAtPath: | (NSString *) | path | |
withIntermediateDirectories: | (BOOL) | createIntermediates | |
attributes: | (NSDictionary *) | attributes | |
error: | (NSError **) | error | |
Create a directory at specific path with attributes.
path | the path of the directory. |
createIntermediates | whether to create the parent directories to the destination directory. |
attributes | attriutes of the directory. |
error | the error occurred while creating directory. |
- (BOOL) createFileAtPath: | (NSString *) | path | |
contents: | (NSData *) | contents | |
attributes: | (NSDictionary *) | attributes | |
Create file with provided content at path.
path | the path of the destination file. |
contents | the data to be written into the file. |
attributes | the attributes of the file. |
- (long long) decryptDataAtPath: | (NSString *) | path |
Decrypt the content of file at path and write to the same path. The file reading/writing process is done without any protection.
the | path of the file. |
- (NSString *) decryptedExternalFileForFileAtPath: | (NSString *) | encryptedFilePath |
Decrypt the file that will be opened in 3rd party app and save it to temperary location if necessary. The file has to be decrypted because 3rd party app could not decrypt the file encrypted by security framework.
the | path of the file to decrypt. |
- (NSInteger) deleteDataAtPath: | (NSString *) | path | |
error: | (NSError **) | error | |
APIs to remove file at a specific path.
path | the path of the file to delete. |
error | out-parameter to tell whether there is error occurred. |
- (NSDictionary*) dictionaryAtFilePath: | (NSString *) | filePath |
Read the content of file into a dictionary. It has to work with writeDictionary:toFileAtPath
filePath | the path of the file to be read from. |
- (NSString*) documentDirectory |
Utility APIs to get regular directories in file system sandbox.
- (BOOL) fileExistsAtPath: | (NSString *) | path |
APIs to tell whether a file/directory exists in the file system.
path | the path of file to check. |
isDirectory | out-parameter to tell whether the file is a directory. |
- (BOOL) fileExistsAtPath: | (NSString *) | path | |
isDirectory: | (BOOL *) | isDirectory | |
+ (id<FileManager>) fileManager |
Return a file manager singleton instance, create one if it does not exist.
- (size_t) incrementalDecryptSoftwareEncryptedDataAtPath: | (NSString *) | path | |
error: | (NSError **) | error | |
Decrypt the data downloaded from Newsstand and write to the file system. This method is only called by Newsstand feature. The file writing process is done without any protection.
the | path of the file. |
error | out-parameter to tell whether there is error occurred. |
- (BOOL) isMappedFileSupported |
The API to tell AE whether the mapped file is supported.
- (NSString*) libraryDirectory |
- (NSInteger) moveItemAtPath: | (NSString *) | path | |
toPath: | (NSString *) | toPath | |
error: | (NSError **) | error | |
APIs to copy/move a file to another destination.
path | file path of the source file. |
toPath | file path of the destination file. |
error | out-parameter to tell whether there is error occurred. |
- (NSInputStream*) newInputStreamWithFileAtPath: | (NSString *) | filePath |
Create and open an input stream for file at path.
filePath | the path of the file. |
- (NSOutputStream*) newOutputStreamToFileAtPath: | (NSString *) | filePath | |
append: | (BOOL) | append | |
Create and open an output stream for file at path.
filePath | the path of the file. |
append | whether to append data or not. |
- (size_t) readData: | (void *) | dataBuf | |
atPath: | (NSString *) | path | |
offset: | (long) | offset | |
length: | (size_t) | length | |
error: | (NSError **) | error | |
Read data from a specific file into a data buffer.
dataBuf | the buffer to which the data is read. |
path | the path of the file. |
offset | the offset of the start point of reading. |
length | length of data to read. |
error | out-parameter to tell whether there is any error occurred. |
- (NSData*) readDataAtPath: | (NSString *) | path | |
error: | (NSError **) | error | |
Read data from a specific file in an encrypted format.
path | the path of the file. |
error | out-parameter to tell whether there is any error occurred. |
- (size_t) readDataInBuffer: | (void **) | dataBuf | |
atPath: | (NSString *) | path | |
offset: | (long) | offset | |
length: | (size_t) | length | |
error: | (NSError **) | error | |
- (NSData*) readDataWithNoProtectionAtPath: | (NSString *) | path | |
error: | (NSError **) | error | |
encrypt: | (bool) | encrypt | |
path | the path of the file. |
error | out-parameter to indicate whether there is error occurred. |
encrypt | whether we need to encrypt data. |
- (NSData*) readDataWithoutEncryptionAtPath: | (NSString *) | path | |
error: | (NSError **) | error | |
- (void) removeDecryptedFileForFile: | (NSString *) | file |
Remove the temperary files generated for 3rd party app.
the | path for the encrypted file. |
- (BOOL) removeItemAtPath: | (NSString *) | path | |
error: | (NSError **) | error | |
- (BOOL) setAttributes: | (NSDictionary *) | attributes | |
ofItemAtPath: | (NSString *) | path | |
error: | (NSError **) | error | |
Set the attributes for a specific file.
attributes | the attributes to get/set. |
path | the path of the file. |
error | out-parameter to tell whether there is any error occurred. |
- (NSArray*) subpathsAtPath: | (NSString *) | path |
Returns the sub paths of a directory.
path | the path of the directory. |
- (NSString*) tempDirectory |
- (void) waitUntilUnlockOperationIsFinished |
Block the file operation while the device is locked.
- (NSInteger) writeData: | (NSData *) | data | |
atPath: | (NSString *) | path | |
error: | (NSError **) | error | |
Write/Append data to a file at path.
data | the data to write. |
path | the path of the destination file. |
error | out-parameter to tell whether there is any error occurred. |
- (NSInteger) writeDataWithNoProtection: | (NSData *) | data | |
atPath: | (NSString *) | path | |
error: | (NSError **) | error | |
encrypt: | (bool) | encrypt | |
the | data to write/append to the file. |
path | the path of the file. |
error | out-parameter to indicate whether there is error occurred. |
encrypt | whether we need to encrypt data. |
- (NSInteger) writeDataWithoutEncryption: | (NSData *) | data | |
atPath: | (NSString *) | path | |
error: | (NSError **) | error | |
- (void) writeDictionary: | (NSDictionary *) | dictionary | |
toFileAtPath: | (NSString *) | filePath | |
Write a dictionary into a file.
dictionary | the dictionary to write. |
filePath | the path of the destination file. |