Stream.st
branchjv
changeset 19635 875eb54afd2c
parent 19611 b1aaf1175f51
parent 19623 8792f5bf0872
child 19660 d48041817c55
--- a/Stream.st	Wed Apr 20 20:11:13 2016 +0100
+++ b/Stream.st	Thu Apr 21 07:59:19 2016 +0100
@@ -1010,7 +1010,7 @@
 !
 
 nextIEEEDouble
-    "read an 8-byte IEEE double precision float number"
+    "read an 8-byte IEEE double precision float number in native byte order"
 
     ^ Float readBinaryIEEEDoubleFrom:self
 !
@@ -1022,7 +1022,7 @@
 !
 
 nextIEEESingle
-    "read a 4-byte IEEE single precision float number"
+    "read a 4-byte IEEE single precision float number in native byte order"
 
     ^ ShortFloat readBinaryIEEESingleFrom:self
 !
@@ -2010,7 +2010,11 @@
 !
 
 nextPutAllUtf16:aString
-    "write a string as UTF-16 bytes"
+    "write a string as UTF-16 characters.
+     Notice: this writes characters - not bytes.
+     The underlying stream must be a stream which can deal with characters,
+     eg. OrderedCollectionStream, TwoByteCharacterStream, etc.
+     Also notice, that characters above 16rFFFF are escaped according UTF16 sepcifications."
 
     |sz "{Class: SmallInteger}"|
 
@@ -2020,6 +2024,18 @@
     ].
 !
 
+nextPutAllUtf16Bytes:aString MSB:msb
+    "write a string as UTF-16 bytes - no 0-word is written.
+     The underlying stream must support writing of bytes"
+
+    |sz "{Class: SmallInteger}"|
+
+    sz := aString size.
+    1 to:sz do:[:idx|
+        self nextPutInt16:(aString at:idx) codePoint MSB:msb.
+    ].
+!
+
 nextPutAllUtf8:aString
     "normal streams can not handle multi-byte characters, so convert them to utf8"
 
@@ -2406,8 +2422,10 @@
 
 nextPutUtf16:aCharacter
     "append my UTF-16 representation to the argument, aStream.
-     UTF-16 can encode only characters with code points between 0 to 16r10FFFF.
-     The collection must be able to store 2-byte values (TwoByteString, OrderedCollection)"
+     Notice: this writes characters - not bytes.
+     The underlying stream must be a stream which can deal with characters,
+     eg. OrderedCollectionStream, TwoByteCharacterStream, etc.
+     Also notice, that characters above 16rFFFF are escaped according UTF16 sepcifications."
 
     |codePoint "{Class: SmallInteger}"|
 
@@ -2438,6 +2456,7 @@
 
 nextPutUtf8:aCharacter
     "append my UTF-8 representation to the argument, aStream.
+     The underlying stream must be a stream which can deal with characters.
      Up to 31 bits can be encoded in up to 6 bytes.
      However, currently, characters are limited to 31 bits."