19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#import "OFTarArchive.h"
#import "OFTarArchiveEntry.h"
#import "OFTarArchiveEntry+Private.h"
#import "OFDate.h"
#import "OFSeekableStream.h"
#import "OFStream.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
#endif
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "OFWriteFailedException.h"
|
<
|
<
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#import "OFTarArchive.h"
#import "OFTarArchiveEntry.h"
#import "OFTarArchiveEntry+Private.h"
#import "OFDate.h"
#import "OFSeekableStream.h"
#import "OFStream.h"
#import "OFURLHandler.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "OFWriteFailedException.h"
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
@synthesize encoding = _encoding;
+ (instancetype)archiveWithStream: (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
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode
|
<
|
|
<
|
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
@synthesize encoding = _encoding;
+ (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode
{
return [[[self alloc] initWithStream: stream mode: mode] autorelease];
}
+ (instancetype)archiveWithURL: (OFURL *)URL mode: (OFString *)mode
{
return [[[self alloc] initWithURL: URL mode: mode] autorelease];
}
- (instancetype)init
{
OF_INVALID_INIT_METHOD
}
- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
[self release];
@throw e;
}
return self;
}
#ifdef OF_HAVE_FILES
- (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode
{
OFFile *file;
if ([mode isEqual: @"a"])
file = [[OFFile alloc] initWithPath: path mode: @"r+"];
else
file = [[OFFile alloc] initWithPath: path mode: mode];
@try {
self = [self initWithStream: file mode: mode];
} @finally {
[file release];
}
return self;
}
#endif
- (void)dealloc
{
[self close];
[super dealloc];
}
|
<
|
>
|
>
|
|
|
<
>
>
>
>
|
|
|
<
<
|
>
<
|
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
[self release];
@throw e;
}
return self;
}
- (instancetype)initWithURL: (OFURL *)URL mode: (OFString *)mode
{
void *pool = objc_autoreleasePoolPush();
OFStream *stream;
@try {
if ([mode isEqual: @"a"])
stream = [OFURLHandler openItemAtURL: URL mode: @"r+"];
else
stream = [OFURLHandler openItemAtURL: URL mode: mode];
} @catch (id e) {
[self release];
@throw e;
}
self = [self initWithStream: stream mode: mode];
objc_autoreleasePoolPop(pool);
return self;
}
- (void)dealloc
{
[self close];
[super dealloc];
}
|