aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPFileHandle.h
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-07-24 21:34:05 +0000
committerstuconnolly <stuart02@gmail.com>2010-07-24 21:34:05 +0000
commitbf1294bd1016672aa3062bb80b546bf2f8037fb3 (patch)
tree121768027638e59af7d5830855bd19b88de7e601 /Source/SPFileHandle.h
parenteb29a57a6860961c0caa00787d779f4cb4117c90 (diff)
downloadsequelpro-bf1294bd1016672aa3062bb80b546bf2f8037fb3.tar.gz
sequelpro-bf1294bd1016672aa3062bb80b546bf2f8037fb3.tar.bz2
sequelpro-bf1294bd1016672aa3062bb80b546bf2f8037fb3.zip
In addition to Gzip compression support when exporting SQL dumps add the ability to use Bzip2 compression.
Other changes include: + Enable the use of export compression (Gzip and Bzip2) for all export formats. + Move the compression options in the export dialog to the 'Advanced' export settings view. + Simplify the setting of common exporter properties (e.g. the connection, use of compression). + Fix a potential memory leak in the dot exporter. + Update the data importer to recognise Bzip2 compressed files. + Fix several display issues on export dialog. + Restore the default .csv file extension of CSV exports. + Correctly update the default export filename when selecting a output compression type. The addition of Bzip2 compression support implements issue #688.
Diffstat (limited to 'Source/SPFileHandle.h')
-rw-r--r--Source/SPFileHandle.h46
1 files changed, 25 insertions, 21 deletions
diff --git a/Source/SPFileHandle.h b/Source/SPFileHandle.h
index 05e05dd5..1bd2ef81 100644
--- a/Source/SPFileHandle.h
+++ b/Source/SPFileHandle.h
@@ -25,13 +25,16 @@
/**
* Provides a class which aims to duplicate some of the most-used functionality
- * of NSFileHandle, while also transparently supporting GZip-compressed content
- * on reading; also supports GZip compression when writing.
+ * of NSFileHandle, while also transparently supporting gzip and bzip2 compressed content
+ * on reading; gzip and bzip2 compression is also supported on writing.
*/
#import <Cocoa/Cocoa.h>
-@interface SPFileHandle : NSObject {
+#import "SPConstants.h"
+
+@interface SPFileHandle : NSObject
+{
void *wrappedFile;
char *wrappedFilePath;
@@ -46,57 +49,58 @@
BOOL dataWritten;
BOOL allDataWritten;
BOOL fileIsClosed;
- BOOL useGzip;
+ BOOL useCompression;
+
+ SPFileCompressionFormat compressionFormat;
}
-
#pragma mark -
#pragma mark Class methods
-+ (id) fileHandleForReadingAtPath:(NSString *)path;
-+ (id) fileHandleForWritingAtPath:(NSString *)path;
-+ (id) fileHandleForPath:(NSString *)path mode:(int)mode;
++ (id)fileHandleForReadingAtPath:(NSString *)path;
++ (id)fileHandleForWritingAtPath:(NSString *)path;
++ (id)fileHandleForPath:(NSString *)path mode:(int)mode;
#pragma mark -
#pragma mark Initialisation
// Returns a file handle initialised with a file
-- (id) initWithFile:(void *)theFile fromPath:(const char *)path mode:(int)mode;
-
+- (id)initWithFile:(void *)theFile fromPath:(const char *)path mode:(int)mode;
#pragma mark -
#pragma mark Data reading
// Reads data up to a specified number of bytes from the file
-- (NSMutableData *) readDataOfLength:(NSUInteger)length;
+- (NSMutableData *)readDataOfLength:(NSUInteger)length;
// Returns the data to the end of the file
-- (NSMutableData *) readDataToEndOfFile;
+- (NSMutableData *)readDataToEndOfFile;
// Returns the on-disk (raw) length of data read so far - can be used in progress bars
-- (NSUInteger) realDataReadLength;
+- (NSUInteger)realDataReadLength;
#pragma mark -
#pragma mark Data writing
-// Set whether data should be written as gzipped data (defaults to NO on a fresh object)
-- (void) setShouldWriteWithGzipCompression:(BOOL)useGzip;
+// Set whether data should be written in the supplied compression format (defaults to NO on a fresh object)
+- (void)setShouldWriteWithCompressionFormat:(SPFileCompressionFormat)useCompressionFormat;
// Write the provided data to the file
-- (void) writeData:(NSData *)data;
+- (void)writeData:(NSData *)data;
// Ensures any buffers are written to disk
-- (void) synchronizeFile;
+- (void)synchronizeFile;
// Prevents further access to the file
-- (void) closeFile;
-
+- (void)closeFile;
#pragma mark -
#pragma mark File information
-// Returns whether gzip compression is enabled on the file
-- (BOOL) isCompressed;
+// Returns whether compression is enabled on the file
+- (BOOL)isCompressed;
+// Returns the compression format being used. Currently gzip or bzip2 only.
+- (SPFileCompressionFormat)compressionFormat;
@end