Differences From Artifact [1114c696d8]:
- File src/OFZIPArchive.m — part of check-in [ccf8ecbb83] at 2017-08-05 17:24:16 on branch trunk — OFGZIPStream: Prepare for adding write support (user: js, size: 14478) [annotate] [blame] [check-ins using]
To Artifact [a7134be3c5]:
- File
src/OFZIPArchive.m
— part of check-in
[c404c33cf1]
at
2017-08-05 18:00:22
on branch trunk
— OFZIPArchive: Don't require an OFSeekableStream
This is now only necessary for reading and appending. (user: js, size: 14579) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #import "OFZIPArchive.h" #import "OFZIPArchiveEntry.h" #import "OFZIPArchiveEntry+Private.h" #import "OFData.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFSeekableStream.h" #ifdef OF_HAVE_FILES # import "OFFile.h" #endif #import "OFInflateStream.h" #import "OFInflate64Stream.h" | > | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFZIPArchive.h" #import "OFZIPArchiveEntry.h" #import "OFZIPArchiveEntry+Private.h" #import "OFData.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFStream.h" #import "OFSeekableStream.h" #ifdef OF_HAVE_FILES # import "OFFile.h" #endif #import "OFInflateStream.h" #import "OFInflate64Stream.h" |
︙ | ︙ | |||
132 133 134 135 136 137 138 | @throw e; } } @implementation OFZIPArchive @synthesize archiveComment = _archiveComment; | | | | | | | > > > | 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | @throw e; } } @implementation OFZIPArchive @synthesize archiveComment = _archiveComment; + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode { return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } #ifdef OF_HAVE_FILES + (instancetype)archiveWithPath: (OFString *)path mode: (OFString *)mode { return [[[self alloc] initWithPath: path mode: mode] autorelease]; } #endif - init { OF_INVALID_INIT_METHOD } - initWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode { self = [super init]; @try { _stream = [stream retain]; if ([mode isEqual: @"r"]) { if (![stream isKindOfClass: [OFSeekableStream class]]) @throw [OFInvalidArgumentException exception]; _mode = OF_ZIP_ARCHIVE_MODE_READ; [self of_readZIPInfo]; [self of_readEntries]; } else if ([mode isEqual: @"w"] || [mode isEqual: @"a"]) @throw [OFNotImplementedException exceptionWithSelector: _cmd |
︙ | ︙ | |||
187 188 189 190 191 192 193 | #ifdef OF_HAVE_FILES - initWithPath: (OFString *)path mode: (OFString *)mode { OFFile *file = [[OFFile alloc] initWithPath: path mode: mode]; @try { | | | | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | #ifdef OF_HAVE_FILES - initWithPath: (OFString *)path mode: (OFString *)mode { OFFile *file = [[OFFile alloc] initWithPath: path mode: mode]; @try { self = [self initWithStream: file mode: mode]; } @finally { [file release]; } return self; } #endif |
︙ | ︙ |