ExternalStream.st
changeset 6569 f8336e46ec9f
parent 6563 f786651428c8
child 6583 e88f2c4ab2a7
--- a/ExternalStream.st	Mon Jun 10 11:21:37 2002 +0200
+++ b/ExternalStream.st	Mon Jun 10 14:37:10 2002 +0200
@@ -4307,15 +4307,22 @@
     "return a collection of the elements up-to the end.
      Return nil if the stream-end is reached before."
 
-    |answerStream ch|
-
-    answerStream := WriteStream on:(self contentsSpecies new).
+    |answerStream buffer count|
+
+    buffer := self contentsSpecies new:4096.
     [self atEnd] whileFalse:[
-	ch := self next.
-	ch notNil ifTrue:[
-	    answerStream nextPut:ch
-	]
+        count := self nextAvailableBytes:4096 into:buffer startingAt:1.
+        count ~~ 0 ifTrue:[
+            answerStream isNil ifTrue:[
+                answerStream := WriteStream with:buffer.
+                answerStream position:count+1.
+                buffer := self contentsSpecies new:4096.
+            ] ifFalse:[
+                answerStream nextPutAll:buffer startingAt:1 to:count.
+            ].
+        ].
     ].
+
     ^ answerStream contents
 
     "Created: 25.4.1996 / 14:40:31 / cg"
@@ -5736,6 +5743,6 @@
 !ExternalStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.237 2002-05-21 09:43:22 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.238 2002-06-10 12:37:10 stefan Exp $'
 ! !
 ExternalStream initialize!