51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
- (void)of_skip;
@end
OF_DIRECT_MEMBERS
@interface OFLHAArchiveFileWriteStream: OFStream <OFReadyForWritingObserving>
{
OFMutableLHAArchiveEntry *_entry;
of_string_encoding_t _encoding;
OFSeekableStream *_stream;
of_offset_t _headerOffset;
uint32_t _bytesWritten;
uint16_t _CRC16;
}
- (instancetype)of_initWithStream: (OFSeekableStream *)stream
entry: (OFLHAArchiveEntry *)entry
encoding: (of_string_encoding_t)encoding;
@end
@implementation OFLHAArchive
@synthesize encoding = _encoding;
+ (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode
{
|
|
|
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
- (void)of_skip;
@end
OF_DIRECT_MEMBERS
@interface OFLHAArchiveFileWriteStream: OFStream <OFReadyForWritingObserving>
{
OFMutableLHAArchiveEntry *_entry;
OFStringEncoding _encoding;
OFSeekableStream *_stream;
of_offset_t _headerOffset;
uint32_t _bytesWritten;
uint16_t _CRC16;
}
- (instancetype)of_initWithStream: (OFSeekableStream *)stream
entry: (OFLHAArchiveEntry *)entry
encoding: (OFStringEncoding)encoding;
@end
@implementation OFLHAArchive
@synthesize encoding = _encoding;
+ (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode
{
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
![_stream isKindOfClass: [OFSeekableStream class]])
@throw [OFInvalidArgumentException exception];
if (_mode == OF_LHA_ARCHIVE_MODE_APPEND)
[(OFSeekableStream *)_stream seekToOffset: 0
whence: SEEK_END];
_encoding = OF_STRING_ENCODING_ISO_8859_1;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
|
|
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
![_stream isKindOfClass: [OFSeekableStream class]])
@throw [OFInvalidArgumentException exception];
if (_mode == OF_LHA_ARCHIVE_MODE_APPEND)
[(OFSeekableStream *)_stream seekToOffset: 0
whence: SEEK_END];
_encoding = OFStringEncodingISO8859_1;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
|
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
[super close];
}
@end
@implementation OFLHAArchiveFileWriteStream
- (instancetype)of_initWithStream: (OFSeekableStream *)stream
entry: (OFLHAArchiveEntry *)entry
encoding: (of_string_encoding_t)encoding
{
self = [super init];
@try {
_entry = [entry mutableCopy];
_encoding = encoding;
|
|
|
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
[super close];
}
@end
@implementation OFLHAArchiveFileWriteStream
- (instancetype)of_initWithStream: (OFSeekableStream *)stream
entry: (OFLHAArchiveEntry *)entry
encoding: (OFStringEncoding)encoding
{
self = [super init];
@try {
_entry = [entry mutableCopy];
_encoding = encoding;
|