︙ | | | ︙ | |
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#import "OFData.h"
#import "OFBase64.h"
#import "OFDictionary.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
# import "OFFileManager.h"
#endif
#import "OFStream.h"
#import "OFString.h"
#import "OFSystemInfo.h"
#import "OFURI.h"
#import "OFURIHandler.h"
#import "OFXMLElement.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
|
>
>
<
<
|
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
#import "OFData.h"
#import "OFBase64.h"
#import "OFDictionary.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
# import "OFFileManager.h"
#endif
#import "OFIRI.h"
#import "OFIRIHandler.h"
#import "OFStream.h"
#import "OFString.h"
#import "OFSystemInfo.h"
#import "OFXMLElement.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFNotImplementedException.h"
#import "OFOutOfMemoryException.h"
#import "OFOutOfRangeException.h"
|
︙ | | | ︙ | |
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#ifdef OF_HAVE_FILES
+ (instancetype)dataWithContentsOfFile: (OFString *)path
{
return [[[self alloc] initWithContentsOfFile: path] autorelease];
}
#endif
+ (instancetype)dataWithContentsOfURI: (OFURI *)URI
{
return [[[self alloc] initWithContentsOfURI: URI] autorelease];
}
+ (instancetype)dataWithStringRepresentation: (OFString *)string
{
return [[[self alloc]
initWithStringRepresentation: string] autorelease];
}
|
|
|
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
#ifdef OF_HAVE_FILES
+ (instancetype)dataWithContentsOfFile: (OFString *)path
{
return [[[self alloc] initWithContentsOfFile: path] autorelease];
}
#endif
+ (instancetype)dataWithContentsOfIRI: (OFIRI *)IRI
{
return [[[self alloc] initWithContentsOfIRI: IRI] autorelease];
}
+ (instancetype)dataWithStringRepresentation: (OFString *)string
{
return [[[self alloc]
initWithStringRepresentation: string] autorelease];
}
|
︙ | | | ︙ | |
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
@throw e;
}
return self;
}
#endif
- (instancetype)initWithContentsOfURI: (OFURI *)URI
{
self = [super init];
@try {
void *pool = objc_autoreleasePoolPush();
OFStream *stream = [OFURIHandler openItemAtURI: URI mode: @"r"];
size_t pageSize;
unsigned char *buffer;
_count = 0;
_itemSize = 1;
_freeWhenDone = true;
|
|
|
|
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
|
@throw e;
}
return self;
}
#endif
- (instancetype)initWithContentsOfIRI: (OFIRI *)IRI
{
self = [super init];
@try {
void *pool = objc_autoreleasePoolPush();
OFStream *stream = [OFIRIHandler openItemAtIRI: IRI mode: @"r"];
size_t pageSize;
unsigned char *buffer;
_count = 0;
_itemSize = 1;
_freeWhenDone = true;
|
︙ | | | ︙ | |
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
|
[file writeBuffer: _items length: _count * _itemSize];
} @finally {
[file release];
}
}
#endif
- (void)writeToURI: (OFURI *)URI
{
void *pool = objc_autoreleasePoolPush();
[[OFURIHandler openItemAtURI: URI mode: @"w"] writeData: self];
objc_autoreleasePoolPop(pool);
}
- (OFXMLElement *)XMLElementBySerializing
{
void *pool;
|
|
|
|
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
|
[file writeBuffer: _items length: _count * _itemSize];
} @finally {
[file release];
}
}
#endif
- (void)writeToIRI: (OFIRI *)IRI
{
void *pool = objc_autoreleasePoolPush();
[[OFIRIHandler openItemAtIRI: IRI mode: @"w"] writeData: self];
objc_autoreleasePoolPop(pool);
}
- (OFXMLElement *)XMLElementBySerializing
{
void *pool;
|
︙ | | | ︙ | |