ExternalStream.st
changeset 7700 767e11efc326
parent 7685 535a69a7cd69
child 7737 616d849b7838
equal deleted inserted replaced
7699:9bf7adc6116d 7700:767e11efc326
  2888 !
  2888 !
  2889 
  2889 
  2890 copyToEndInto:outStream
  2890 copyToEndInto:outStream
  2891     "copy the data into another stream."
  2891     "copy the data into another stream."
  2892 
  2892 
  2893     |bufferSize|
  2893     |bufferSize pos n nWritten|
       
  2894 
       
  2895     self isFileStream ifTrue:[
       
  2896         outStream isExternalStream ifTrue:[
       
  2897             pos := self position.
       
  2898             n := self size - pos.
       
  2899             nWritten := OperatingSystem 
       
  2900                 copyFromFd:(self fileDescriptor)
       
  2901                 toFd:(outStream fileDescriptor)
       
  2902                 startIndex:pos 
       
  2903                 count:n.
       
  2904             nWritten = n ifTrue:[
       
  2905                 ^ self
       
  2906             ]
       
  2907         ]
       
  2908     ].
  2894 
  2909 
  2895     OperatingSystem isMSDOSlike ifTrue:[
  2910     OperatingSystem isMSDOSlike ifTrue:[
  2896 	"/ mhmh - NT hangs, when copying bigger blocks to a network drive - why ?
  2911         "/ mhmh - NT hangs, when copying bigger blocks to a network drive - why ?
  2897 	bufferSize := 1 * 1024.
  2912         bufferSize := 1 * 1024.
  2898     ] ifFalse:[
  2913     ] ifFalse:[
  2899 	bufferSize := 8 * 1024.
  2914         bufferSize := 8 * 1024.
  2900     ].
  2915     ].
  2901 
  2916 
  2902     ^ self copyToEndInto:outStream bufferSize:bufferSize
  2917     ^ self copyToEndInto:outStream bufferSize:bufferSize
       
  2918 
       
  2919     "
       
  2920      |in out|
       
  2921 
       
  2922      in := 'Makefile' asFilename readStream.
       
  2923      out := Stdout.
       
  2924      in copyToEndInto:out.
       
  2925      in close.
       
  2926     "
  2903 !
  2927 !
  2904 
  2928 
  2905 create
  2929 create
  2906     "create the stream
  2930     "create the stream
  2907      - this must be redefined in subclass"
  2931      - this must be redefined in subclass"
  5733 ! !
  5757 ! !
  5734 
  5758 
  5735 !ExternalStream class methodsFor:'documentation'!
  5759 !ExternalStream class methodsFor:'documentation'!
  5736 
  5760 
  5737 version
  5761 version
  5738     ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.261 2003-10-23 15:43:08 cg Exp $'
  5762     ^ '$Header: /cvs/stx/stx/libbasic/ExternalStream.st,v 1.262 2003-10-27 18:03:45 cg Exp $'
  5739 ! !
  5763 ! !
  5740 
  5764 
  5741 ExternalStream initialize!
  5765 ExternalStream initialize!