28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#import "OFSeekableStream.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFChecksumMismatchException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotOpenException.h"
#import "OFTruncatedDataException.h"
#import "OFUnsupportedVersionException.h"
enum {
modeRead
};
|
>
|
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#import "OFSeekableStream.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFChecksumMismatchException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"
#import "OFNotOpenException.h"
#import "OFTruncatedDataException.h"
#import "OFUnsupportedVersionException.h"
enum {
modeRead
};
|
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode
{
self = [super init];
@try {
if ([mode isEqual: @"r"])
_mode = modeRead;
else
@throw [OFInvalidArgumentException exception];
_stream = [stream retain];
_encoding = OFStringEncodingUTF8;
if (_mode == modeRead) {
|
>
>
>
>
|
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
- (instancetype)initWithStream: (OFStream *)stream mode: (OFString *)mode
{
self = [super init];
@try {
if ([mode isEqual: @"r"])
_mode = modeRead;
else if ([mode isEqual: @"w"] || [mode isEqual: @"a"])
@throw [OFNotImplementedException
exceptionWithSelector: _cmd
object: nil];
else
@throw [OFInvalidArgumentException exception];
_stream = [stream retain];
_encoding = OFStringEncodingUTF8;
if (_mode == modeRead) {
|