Differences From Artifact [161538a2bd]:
- File src/OFZIPArchive.m — part of check-in [e7ab06503c] at 2022-09-28 21:40:00 on branch trunk — Rename OFUR{L -> I} in preparation for URI support (user: js, size: 24085) [annotate] [blame] [check-ins using]
To Artifact [d0b4f286d3]:
- File
src/OFZIPArchive.m
— part of check-in
[19bbbbd95d]
at
2022-10-04 21:33:53
on branch trunk
— Add +[OFZIPArchive URIForFile:inArchive:]
This allows constructing a URI to access a file within an archive. (user: js, size: 24769) [annotate] [blame] [check-ins using]
︙ | |||
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | + | #import "OFCRC32.h" #import "OFData.h" #import "OFDictionary.h" #import "OFInflate64Stream.h" #import "OFInflateStream.h" #import "OFSeekableStream.h" #import "OFStream.h" #import "OFURI.h" #import "OFURIHandler.h" #import "OFChecksumMismatchException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFNotOpenException.h" |
︙ | |||
162 163 164 165 166 167 168 169 170 171 172 173 174 175 | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | + + + + + + + + + + + + + + + + + + + + + + + + | return [[[self alloc] initWithStream: stream mode: mode] autorelease]; } + (instancetype)archiveWithURI: (OFURI *)URI mode: (OFString *)mode { return [[[self alloc] initWithURI: URI mode: mode] autorelease]; } + (OFURI *)URIForFile: (OFString *)path inArchive: (OFURI *)archive { OFMutableURI *URI = [OFMutableURI URI]; void *pool = objc_autoreleasePoolPush(); OFCharacterSet *characterSet = [OFCharacterSet of_URIPathAllowedCharacterSetWithoutExclamationMark]; OFString *archiveURI; path = [path stringByAddingPercentEncodingWithAllowedCharacters: characterSet]; archiveURI = [archive.string stringByAddingPercentEncodingWithAllowedCharacters: characterSet]; URI.scheme = @"of-zip"; URI.percentEncodedPath = [OFString stringWithFormat: @"%@!%@", archiveURI, path]; [URI makeImmutable]; objc_autoreleasePoolPop(pool); return URI; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode |
︙ |