--- a/Stream.st Wed Mar 13 12:01:21 2019 +0100
+++ b/Stream.st Wed Mar 13 12:51:41 2019 +0100
@@ -754,14 +754,11 @@
"read loop: read required bytes"
[
- |readCount|
-
- readCount := self nextAvailable:bytesLeft into:buffer startingAt:1.
- bytesLeft := bytesLeft - readCount.
-
- readCount > 0 ifTrue:[
- |writeCount|
-
+ |readCount writeCount|
+
+ readCount := self nextAvailable:(bytesLeft min:bufferSize) into:buffer startingAt:1.
+ readCount ~~ 0 ifTrue:[
+ bytesLeft := bytesLeft - readCount.
writeCount := 0.
"write loop: write until all is written"
[
@@ -789,7 +786,16 @@
freeBuffer ifTrue:[ buffer free ].
^ countWritten.
+ "
+ |s|
+ s := WriteStream on:(String new:100).
+ '/etc/passwd' asFilename readStream
+ copy:100 into:s bufferSize:10.
+ s contents
+ "
+
"Modified: / 13-03-2019 / 12:00:46 / Claus Gittinger"
+ "Modified: / 13-03-2019 / 12:50:48 / Stefan Vogel"
!
copyToEndFrom:inStream