GPKGIOUtils
Objective-C
@interface GPKGIOUtils : NSObject
/**
* Get the path of the property list file with name
*
* @param name plist base file name
*
* @return property list file path
*/
+(NSString *) propertyListPathWithName: (NSString *) name;
/**
* Get the path of the resource file with name and file type
*
* @param name file name
* @param type extension type
*
* @return file resource path
*/
+(NSString *) resourcePathWithName: (NSString *) name andType: (NSString *) type;
/**
* Get the documents directory path
*
* @return documents directory
*/
+(NSString *) documentsDirectory;
/**
* Get a sub directory path within the document directory
*
* @param subDirectory sub directory path
*
* @return documents sub directory path
*/
+(NSString *) documentsDirectoryWithSubDirectory: (NSString *) subDirectory;
/**
* Get the GeoPackage directory path for saving GeoPackage related files
*
* @return GeoPackage directory
*/
+(NSString *) geoPackageDirectory;
/**
* Get the GeoPackage database directory path for saving GeoPackages
*
* @return GeoPackage database directory
*/
+(NSString *) databaseDirectory;
/**
* Get the GeoPackage metadata directory path for saving metadata
*
* @return GeoPackage metadata directory
*/
+(NSString *) metadataDirectory;
/**
* Get the GeoPackage metadata database file path
*
* @return GeoPackage metadata database file path
*/
+(NSString *) metadataDatabaseFile;
/**
* Create a directory if it does not exist
*
* @param directory directory to create
*/
+(void) createDirectoryIfNotExists: (NSString *) directory;
/**
* Get the local path within the provided directory by removing the documents directory
*
* @param directory full directory path
*
* @return sub path
*/
+(NSString *) localDocumentsDirectoryPath: (NSString *) directory;
/**
* Copy a file
*
* @param copyFrom file to copy
* @param copyTo file location to copy to
*/
+(void) copyFile: (NSString *) copyFrom toFile: (NSString *) copyTo;
/**
* Copy an input stream to a file
*
* @param copyFrom input stream to copy
* @param copyTo file location to copy to
*/
+(void) copyInputStream: (NSInputStream *) copyFrom toFile: (NSString *) copyTo;
/**
* Copy an input stream to a file with progress callbacks
*
* @param copyFrom input stream to copy
* @param copyTo file location to copy to
* @param progress progress callbacks
*/
+(void) copyInputStream: (NSInputStream *) copyFrom toFile: (NSString *) copyTo withProgress: (NSObject<GPKGProgress> *) progress;
/**
* Get the file byte data
*
* @param file file path
*
* @return byte data
*/
+(NSData *) fileData: (NSString *) file;
/**
* Get the input stream byte data
*
* @param stream input stream
*
* @return input stream byte data
*/
+(NSData *) streamData: (NSInputStream *) stream;
/**
* Get the input stream string
*
* @param stream input stream
*
* @return input stream string
*/
+(NSString *) streamString: (NSInputStream *) stream;
/**
* Get the input stream string
*
* @param stream input stream
* @param encoding string encoding
*
* @return input stream string
*/
+(NSString *) streamString: (NSInputStream *) stream withEncoding: (NSStringEncoding) encoding;
/**
* Copy the input stream to an output stream
*
* @param copyFrom input stream
* @param copyTo output stream
*/
+(void) copyInputStream: (NSInputStream *) copyFrom toOutputStream: (NSOutputStream *) copyTo;
/**
* Copy the input stream to an output stream with progress callbacks
*
* @param copyFrom input stream
* @param copyTo output stream
* @param progress progress callbacks
*/
+(void) copyInputStream: (NSInputStream *) copyFrom toOutputStream: (NSOutputStream *) copyTo withProgress: (NSObject<GPKGProgress> *) progress;
/**
* Delete the file
*
* @param file file path
*
* @return true if deleted
*/
+(BOOL) deleteFile: (NSString *) file;
/**
* Format the bytes into readable text
*
* @param bytes bytes
*
* @return byte text
*/
+(NSString *) formatBytes: (int) bytes;
/**
* Decode a URL
*
* @param url url
*
* @return decoded url
*/
+(NSString *) decodeUrl: (NSString *) url;
@end
Swift
class GPKGIOUtils : NSObject
Undocumented
-
Get the path of the property list file with name
Declaration
Objective-C
+ (NSString *)propertyListPathWithName:(NSString *)name;
Swift
class func propertyListPath(withName name: String!) -> String!
Parameters
name
plist base file name
Return Value
property list file path
-
Get the path of the resource file with name and file type
Declaration
Objective-C
+ (NSString *)resourcePathWithName:(NSString *)name andType:(NSString *)type;
Swift
class func resourcePath(withName name: String!, andType type: String!) -> String!
Parameters
name
file name
type
extension type
Return Value
file resource path
-
Get the documents directory path
Declaration
Objective-C
+ (NSString *)documentsDirectory;
Swift
class func documentsDirectory() -> String!
Return Value
documents directory
-
Get a sub directory path within the document directory
Declaration
Objective-C
+ (NSString *)documentsDirectoryWithSubDirectory:(NSString *)subDirectory;
Swift
class func documentsDirectory(withSubDirectory subDirectory: String!) -> String!
Parameters
subDirectory
sub directory path
Return Value
documents sub directory path
-
Get the GeoPackage directory path for saving GeoPackage related files
Declaration
Objective-C
+ (NSString *)geoPackageDirectory;
Swift
class func geoPackageDirectory() -> String!
Return Value
GeoPackage directory
-
Get the GeoPackage database directory path for saving GeoPackages
Declaration
Objective-C
+ (NSString *)databaseDirectory;
Swift
class func databaseDirectory() -> String!
Return Value
GeoPackage database directory
-
Get the GeoPackage metadata directory path for saving metadata
Declaration
Objective-C
+ (NSString *)metadataDirectory;
Swift
class func metadataDirectory() -> String!
Return Value
GeoPackage metadata directory
-
Get the GeoPackage metadata database file path
Declaration
Objective-C
+ (NSString *)metadataDatabaseFile;
Swift
class func metadataDatabaseFile() -> String!
Return Value
GeoPackage metadata database file path
-
Create a directory if it does not exist
Declaration
Objective-C
+ (void)createDirectoryIfNotExists:(NSString *)directory;
Swift
class func createDirectoryIfNotExists(_ directory: String!)
Parameters
directory
directory to create
-
Get the local path within the provided directory by removing the documents directory
Declaration
Objective-C
+ (NSString *)localDocumentsDirectoryPath:(NSString *)directory;
Swift
class func localDocumentsDirectoryPath(_ directory: String!) -> String!
Parameters
directory
full directory path
Return Value
sub path
-
Copy a file
Declaration
Objective-C
+ (void)copyFile:(NSString *)copyFrom toFile:(NSString *)copyTo;
Swift
class func copyFile(_ copyFrom: String!, toFile copyTo: String!)
Parameters
copyFrom
file to copy
copyTo
file location to copy to
-
Copy an input stream to a file
Declaration
Objective-C
+ (void)copyInputStream:(NSInputStream *)copyFrom toFile:(NSString *)copyTo;
Swift
class func copy(_ copyFrom: InputStream!, toFile copyTo: String!)
Parameters
copyFrom
input stream to copy
copyTo
file location to copy to
-
Copy an input stream to a file with progress callbacks
Declaration
Objective-C
+ (void)copyInputStream:(NSInputStream *)copyFrom toFile:(NSString *)copyTo withProgress:(NSObject<GPKGProgress> *)progress;
Swift
class func copy(_ copyFrom: InputStream!, toFile copyTo: String!, with progress: (any GPKGProgress)!)
Parameters
copyFrom
input stream to copy
copyTo
file location to copy to
progress
progress callbacks
-
Get the file byte data
Declaration
Objective-C
+ (NSData *)fileData:(NSString *)file;
Swift
class func fileData(_ file: String!) -> Data!
Parameters
file
file path
Return Value
byte data
-
Get the input stream byte data
Declaration
Objective-C
+ (NSData *)streamData:(NSInputStream *)stream;
Swift
class func streamData(_ stream: InputStream!) -> Data!
Parameters
stream
input stream
Return Value
input stream byte data
-
Get the input stream string
Declaration
Objective-C
+ (NSString *)streamString:(NSInputStream *)stream;
Swift
class func streamString(_ stream: InputStream!) -> String!
Parameters
stream
input stream
Return Value
input stream string
-
Get the input stream string
Declaration
Objective-C
+ (NSString *)streamString:(NSInputStream *)stream withEncoding:(NSStringEncoding)encoding;
Swift
class func streamString(_ stream: InputStream!, withEncoding encoding: UInt) -> String!
Parameters
stream
input stream
encoding
string encoding
Return Value
input stream string
-
Copy the input stream to an output stream
Declaration
Objective-C
+ (void)copyInputStream:(NSInputStream *)copyFrom toOutputStream:(NSOutputStream *)copyTo;
Swift
class func copy(_ copyFrom: InputStream!, to copyTo: OutputStream!)
Parameters
copyFrom
input stream
copyTo
output stream
-
Copy the input stream to an output stream with progress callbacks
Declaration
Objective-C
+ (void)copyInputStream:(NSInputStream *)copyFrom toOutputStream:(NSOutputStream *)copyTo withProgress:(NSObject<GPKGProgress> *)progress;
Swift
class func copy(_ copyFrom: InputStream!, to copyTo: OutputStream!, with progress: (any GPKGProgress)!)
Parameters
copyFrom
input stream
copyTo
output stream
progress
progress callbacks
-
Delete the file
Declaration
Objective-C
+ (BOOL)deleteFile:(NSString *)file;
Swift
class func deleteFile(_ file: String!) -> Bool
Parameters
file
file path
Return Value
true if deleted
-
Format the bytes into readable text
Declaration
Objective-C
+ (NSString *)formatBytes:(int)bytes;
Swift
class func formatBytes(_ bytes: Int32) -> String!
Parameters
bytes
bytes
Return Value
byte text
-
Decode a URL
Declaration
Objective-C
+ (NSString *)decodeUrl:(NSString *)url;
Swift
class func decodeUrl(_ url: String!) -> String!
Parameters
url
url
Return Value
decoded url