Mobile API Reference  MicroStrategy 2019
FileManager.h
Go to the documentation of this file.
1 //
2 // FileManager.h
3 // MicroStrategyMobile
4 //
5 // Created by Amirali Charania on 10/31/11.
6 // Copyright 2011 MicroStrategy Inc. All rights reserved.
7 //
8 
9 #import <UIKit/UIKit.h>
10 
11 @protocol FileManager
12 
18 
26 -(BOOL)createDirectoryAtPath:(NSString*)path withIntermediateDirectories:(BOOL)createIntermediates
27  attributes:(NSDictionary*)attributes error:(NSError**)error;
28 
35 -(NSArray*)contentsOfDirectoryAtPath:(NSString*)path error:(NSError**)error;
36 
42 -(NSArray*)subpathsAtPath:(NSString *)path;
43 
50 -(BOOL)fileExistsAtPath:(NSString*)path;
51 -(BOOL)fileExistsAtPath:(NSString*)path isDirectory:(BOOL*)isDirectory;
52 
60 -(BOOL)setAttributes:(NSDictionary *)attributes ofItemAtPath:(NSString*)path error:(NSError **)error;
61 
68 -(NSDictionary *)attributesOfItemAtPath:(NSString *)path error:(NSError **)error;
69 
76 -(NSData*)readDataAtPath:(NSString*)path error:(NSError**)error;
77 -(NSData*)readDataWithoutEncryptionAtPath:(NSString*)path error:(NSError**)error;
78 
88 -(size_t)readData:(void*)dataBuf atPath:(NSString*)path offset:(long)offset
89  length:(size_t)length error:(NSError**)error;
90 -(size_t)readDataInBuffer:(void**)dataBuf atPath:(NSString*)path offset:(long)offset
91  length:(size_t)length error:(NSError**)error;
92 
100 -(NSInteger)writeData:(NSData*)data atPath:(NSString*)path error:(NSError**)error;
101 -(NSInteger)appendData:(NSData*)data atPath:(NSString*)path error:(NSError**)error;
102 -(NSInteger)writeDataWithoutEncryption:(NSData*)data atPath:(NSString*)path error:(NSError**)error; // DE96741, custom widget files ignore file encryption for both write/read
103 
111 -(BOOL)createFileAtPath:(NSString*)path contents:(NSData*)contents attributes:(NSDictionary*)attributes;
112 
118 -(void)writeDictionary:(NSDictionary*)dictionary toFileAtPath:(NSString*)filePath;
119 
125 -(NSDictionary*)dictionaryAtFilePath:(NSString*)filePath;
126 
127 
128 //APIs to read/write/append data from a specific file without protection. These APIs are used to read/write/append data when device is locked. At this point, the data is not encrypted, data encryption could be done in these method if necessary.
135 -(NSData*)readDataWithNoProtectionAtPath:(NSString*)path error:(NSError**)error encrypt:(bool)encrypt;
136 
143 -(NSInteger)writeDataWithNoProtection:(NSData*)data atPath:(NSString*)path error:(NSError**)error encrypt:(bool)encrypt;
144 -(NSInteger)appendDataWithNoProtection:(NSData*)data atPath:(NSString*)path error:(NSError**)error encrypt:(bool)encrypt;
145 
152 -(NSOutputStream*)newOutputStreamToFileAtPath:(NSString*)filePath append:(BOOL)append;
153 
159 -(NSInputStream*)newInputStreamWithFileAtPath:(NSString*)filePath;
160 
168 -(NSInteger)moveItemAtPath:(NSString*)path toPath:(NSString*)toPath error:(NSError**)error;
169 -(NSInteger)copyItemAtPath:(NSString*)path toPath:(NSString*)toPath error:(NSError**)error;
170 
177 -(NSInteger)deleteDataAtPath:(NSString*)path error:(NSError**)error;
178 -(BOOL)removeItemAtPath:(NSString*)path error:(NSError**)error;
179 
183 -(void)clearTmpDirectory;
184 
188 -(NSString*)documentDirectory;
189 -(NSString*)cachesDirectory;
190 -(NSString*)libraryDirectory;
191 -(NSString*)tempDirectory;
192 
197 
202 
209 -(long long)decryptDataAtPath:(NSString*)path;
210 
219 -(size_t)incrementalDecryptSoftwareEncryptedDataAtPath:(NSString *)path error:(NSError **)error;
220 
228 - (NSString *) decryptedExternalFileForFileAtPath:(NSString *)encryptedFilePath;
229 
236 - (void) removeDecryptedFileForFile:(NSString *)file;
237 @end
238 
signed char BOOL
Definition: PDCwtypes.h:101
void clearTmpDirectory()
id< FileManager > fileManager()
Definition: FileManager.h:11
NSString * libraryDirectory()
BOOL isMappedFileSupported()
NSString * documentDirectory()
void waitUntilUnlockOperationIsFinished()
NSString * tempDirectory()
NSString * cachesDirectory()