--- a/FileStream.st Thu Mar 12 12:49:35 2015 +0100
+++ b/FileStream.st Thu Mar 12 14:52:37 2015 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -894,16 +896,16 @@
pos := self position.
n := self size - pos.
nWritten := OperatingSystem
- copyFromFd:(self fileDescriptor)
- toFd:(outStream fileDescriptor)
- startIndex:pos
- count:n.
+ copyFromFd:self fileDescriptor
+ toFd:outStream fileDescriptor
+ startIndex:pos
+ count:n.
+ nWritten > 0 ifTrue:[
+ self position:pos+nWritten.
+ ].
nWritten = n ifTrue:[
^ self
].
- nWritten > 0 ifTrue:[
- self position:pos+nWritten.
- ].
].
^ super copyToEndInto:outStream bufferSize:bufferSize.
@@ -1993,6 +1995,13 @@
!FileStream methodsFor:'queries'!
+collectionSize
+ "common stream protocol: return the size of the stream;
+ thats the number of bytes of the file."
+
+ ^ self fileSize.
+!
+
fileSize
"return the size in bytes of the file"
@@ -2062,6 +2071,12 @@
^ self fileSize == 0.
!
+remainingSize
+ "return the number of remaining elements in the streamed collection."
+
+ ^ self fileSize - self position.
+!
+
size
"common stream protocol: return the size of the stream;
thats the number of bytes of the file."
@@ -2091,11 +2106,11 @@
!FileStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.179 2015-01-21 18:44:21 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.180 2015-03-12 13:52:37 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.179 2015-01-21 18:44:21 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/FileStream.st,v 1.180 2015-03-12 13:52:37 stefan Exp $'
! !