699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
|
- (int)fileDescriptorForReading
{
return [_stream fileDescriptorForReading];
}
- (bool)hasDataInReadBuffer
{
return ([super hasDataInReadBuffer] || [_stream hasDataInReadBuffer]);
}
- (void)close
{
/* Give back our buffer to the stream, in case it's shared */
[_stream unreadFromBuffer: _buffer + _bufferIndex
length: _bufferLength - _bufferIndex];
|
|
>
|
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
|
- (int)fileDescriptorForReading
{
return [_stream fileDescriptorForReading];
}
- (bool)hasDataInReadBuffer
{
return ([super hasDataInReadBuffer] || [_stream hasDataInReadBuffer] ||
_bufferLength - _bufferIndex > 0);
}
- (void)close
{
/* Give back our buffer to the stream, in case it's shared */
[_stream unreadFromBuffer: _buffer + _bufferIndex
length: _bufferLength - _bufferIndex];
|
789
790
791
792
793
794
795
796
797
798
799
800
801
802
|
if (_stream == nil)
@throw [OFNotOpenException exceptionWithObject: self];
if (_atEndOfStream)
return 0;
if (length > _toRead)
length = _toRead;
ret = [_decompressedStream readIntoBuffer: buffer
length: length];
_toRead -= ret;
|
>
>
>
>
|
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
|
if (_stream == nil)
@throw [OFNotOpenException exceptionWithObject: self];
if (_atEndOfStream)
return 0;
if ([_stream isAtEndOfStream] &&
![_decompressedStream hasDataInReadBuffer])
@throw [OFTruncatedDataException exception];
if (length > _toRead)
length = _toRead;
ret = [_decompressedStream readIntoBuffer: buffer
length: length];
_toRead -= ret;
|