Stream.st
changeset 22494 1a4b0c111a03
parent 22433 b9cb6fd5d853
child 22515 5c82715dba15
--- a/Stream.st	Fri Jan 19 18:50:52 2018 +0100
+++ b/Stream.st	Fri Jan 19 19:23:42 2018 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -2047,7 +2045,7 @@
 
     "
         (#[] writeStream
-            nextPutAllUtf16Bytes:'BÄxxx' MSB:true;
+            nextPutAllUtf16Bytes:'BÄxxx' MSB:true;
             nextPutUtf16:(Character codePoint:16r10CCCC) MSB:true;
             contents)
    "
@@ -2082,15 +2080,15 @@
         ].
 
         String streamContents:[:s|
-            s nextPutAllUtf8:'abcdeäöüß' asUnicode32String
+            s nextPutAllUtf8:'abcdeäöüß' asUnicode32String
         ].
 .
         ByteArray streamContents:[:s|
-            s nextPutAllUtf8:'abcdeäöüß' asUnicode32String
+            s nextPutAllUtf8:'abcdeäöüß' asUnicode32String
         ].
 
         '/tmp/bytes' asFilename writingFileDo:[:s|
-            s nextPutAllUtf8:'abcdeäöüß'
+            s nextPutAllUtf8:'abcdeäöüß'
         ].
     "
 
@@ -2501,7 +2499,7 @@
     "
         ((WriteStream on:Unicode16String new)
             nextPutUtf16:$B;
-            nextPutUtf16:$Ä; 
+            nextPutUtf16:$Ä; 
             nextPutUtf16:(Character codePoint:16r10CCCC)
             yourself) contents
     "
@@ -2536,19 +2534,19 @@
     "
         (#[] writeStream
             nextPutUtf16Bytes:$B MSB:true;
-            nextPutUtf16Bytes:$Ä MSB:true;
+            nextPutUtf16Bytes:$Ä MSB:true;
             nextPutUtf16Bytes:(Character codePoint:16r10CCCC) MSB:true;
             contents)
 
         ('' writeStream
             nextPutUtf16Bytes:$B MSB:true;
-            nextPutUtf16Bytes:$Ä MSB:true;
+            nextPutUtf16Bytes:$Ä MSB:true;
             nextPutUtf16Bytes:(Character codePoint:16r10CCCC) MSB:true;
             contents)
 
         (FileStream newTemporary
             nextPutUtf16Bytes:$B MSB:false;
-            nextPutUtf16Bytes:$Ä MSB:false;
+            nextPutUtf16Bytes:$Ä MSB:false;
             nextPutUtf16Bytes:(Character codePoint:16r10CCCC) MSB:false;
             reset;
             binary;
@@ -2660,7 +2658,7 @@
     "
       (String streamContents:[:s|
             s nextPutUtf8:$a.
-            s nextPutUtf8:$ü.
+            s nextPutUtf8:$ü.
             s nextPutUtf8: (Character value:16r1fff).
             s nextPutUtf8: (Character value:16rffff).
             s nextPutUtf8: (Character value:16r1ffffff).
@@ -3864,13 +3862,15 @@
     |ms|
 
     secondsOrTimeDurationOrNil notNil ifTrue:[
-        secondsOrTimeDurationOrNil isNumber ifTrue:[
-            ms := secondsOrTimeDurationOrNil * 1000.
+        secondsOrTimeDurationOrNil isTimeDuration ifTrue:[
+            ms := secondsOrTimeDurationOrNil getMilliseconds.
         ] ifFalse:[
-            ms := secondsOrTimeDurationOrNil getMilliseconds.
+            ms := (secondsOrTimeDurationOrNil * 1000) rounded.
         ]
     ].
     ^ self readWaitWithTimeoutMs:ms
+
+    "Modified: / 19-01-2018 / 19:18:26 / stefan"
 !
 
 readWaitWithTimeoutMs:millis
@@ -3911,7 +3911,7 @@
     ^ self writeWaitWithTimeoutMs:timeout
 !
 
-writeWaitWithTimeout:secondsOrTimeDuration
+writeWaitWithTimeout:secondsOrTimeDurationOrNil
     "suspend the current process, until the receiver
      becomes ready for writing or a timeout (in seconds) expired.
      Return true if a timeout occurred (i.e. false, if data is available).
@@ -3920,14 +3920,16 @@
 
     |ms|
 
-    secondsOrTimeDuration notNil ifTrue:[
-        secondsOrTimeDuration isNumber ifTrue:[
-            ms := secondsOrTimeDuration * 1000.
+    secondsOrTimeDurationOrNil notNil ifTrue:[
+        secondsOrTimeDurationOrNil isTimeDuration ifTrue:[
+            ms := secondsOrTimeDurationOrNil getMilliseconds.
         ] ifFalse:[
-            ms := secondsOrTimeDuration getMilliseconds.
+            ms := (secondsOrTimeDurationOrNil * 1000) rounded.
         ]
     ].
     ^ self writeWaitWithTimeoutMs:ms
+
+    "Modified: / 19-01-2018 / 19:19:15 / stefan"
 !
 
 writeWaitWithTimeoutMs:millis