︙ | | |
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
|
#endif
- init
{
if (isa == [OFStream class]) {
Class c = isa;
[self release];
@throw [OFNotImplementedException newWithClass: c
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: c
selector: _cmd];
}
self = [super init];
cache = NULL;
writeBuffer = NULL;
blocking = YES;
return self;
}
- (BOOL)_isAtEndOfStream
{
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: isa
selector: _cmd];
}
- (size_t)_readNBytes: (size_t)length
intoBuffer: (void*)buffer
{
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: isa
selector: _cmd];
}
- (void)_writeNBytes: (size_t)length
fromBuffer: (const void*)buffer
{
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: isa
selector: _cmd];
}
- copy
{
return [self retain];
}
|
︙ | | |
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
|
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
|
-
-
+
+
|
/* FIXME: Convert delimiter to specified charset */
delimiterUTF8String = [delimiter UTF8String];
delimiterLength = [delimiter UTF8StringLength];
j = 0;
if (delimiterLength == 0)
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
@throw [OFInvalidArgumentException exceptionWithClass: isa
selector: _cmd];
/* Look if there's something in our cache */
if (!waitingForDelimiter && cache != NULL) {
for (i = 0; i < cacheLength; i++) {
if (cache[i] != delimiterUTF8String[j++])
j = 0;
|
︙ | | |
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
|
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
|
-
-
+
+
-
+
|
- (size_t)writeFormat: (OFConstantString*)format
withArguments: (va_list)arguments
{
char *UTF8String;
int length;
if (format == nil)
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
@throw [OFInvalidArgumentException exceptionWithClass: isa
selector: _cmd];
if ((length = of_vasprintf(&UTF8String, [format UTF8String],
arguments)) == -1)
@throw [OFInvalidFormatException newWithClass: isa];
@throw [OFInvalidFormatException exceptionWithClass: isa];
@try {
[self writeNBytes: length
fromBuffer: UTF8String];
} @finally {
free(UTF8String);
}
|
︙ | | |
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
|
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
|
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
|
{
#ifndef _WIN32
int flags;
blocking = enable;
if ((flags = fcntl([self fileDescriptor], F_GETFL)) == -1)
@throw [OFSetOptionFailedException newWithClass: isa
stream: self];
@throw [OFSetOptionFailedException exceptionWithClass: isa
stream: self];
if (enable)
flags &= ~O_NONBLOCK;
else
flags |= O_NONBLOCK;
if (fcntl([self fileDescriptor], F_SETFL, flags) == -1)
@throw [OFSetOptionFailedException newWithClass: isa
stream: self];
@throw [OFSetOptionFailedException exceptionWithClass: isa
stream: self];
#else
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: isa
selector: _cmd];
#endif
}
- (int)fileDescriptor
{
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: isa
selector: _cmd];
}
- (void)close
{
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
@throw [OFNotImplementedException exceptionWithClass: isa
selector: _cmd];
}
- (BOOL)_isWaitingForDelimiter
{
return waitingForDelimiter;
}
@end
|