ExternalStream.st
changeset 7700 767e11efc326
parent 7685 535a69a7cd69
child 7737 616d849b7838
--- a/ExternalStream.st	Mon Oct 27 19:03:18 2003 +0100
+++ b/ExternalStream.st	Mon Oct 27 19:03:45 2003 +0100
@@ -2890,16 +2890,40 @@
 copyToEndInto:outStream
     "copy the data into another stream."
 
-    |bufferSize|
+    |bufferSize pos n nWritten|
+
+    self isFileStream ifTrue:[
+        outStream isExternalStream ifTrue:[
+            pos := self position.
+            n := self size - pos.
+            nWritten := OperatingSystem 
+                copyFromFd:(self fileDescriptor)
+                toFd:(outStream fileDescriptor)
+                startIndex:pos 
+                count:n.
+            nWritten = n ifTrue:[
+                ^ self
+            ]
+        ]
+    ].
 
     OperatingSystem isMSDOSlike ifTrue:[
-	"/ mhmh - NT hangs, when copying bigger blocks to a network drive - why ?
-	bufferSize := 1 * 1024.
+        "/ mhmh - NT hangs, when copying bigger blocks to a network drive - why ?
+        bufferSize := 1 * 1024.
     ] ifFalse:[
-	bufferSize := 8 * 1024.
+        bufferSize := 8 * 1024.
     ].
 
     ^ self copyToEndInto:outStream bufferSize:bufferSize
+
+    "
+     |in out|
+
+     in := 'Makefile' asFilename readStream.
+     out := Stdout.
+     in copyToEndInto:out.
+     in close.
+    "
 !
 
 create
@@ -5735,7 +5759,7 @@
 !ExternalStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.261 2003-10-23 15:43:08 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.262 2003-10-27 18:03:45 cg Exp $'
 ! !
 
 ExternalStream initialize!