#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Tue, 19 Apr 2016 16:43:19 +0200
changeset 19604 db92dc60b19d
parent 19603 635197c5e78b
child 19605 610182b96867
#FEATURE by cg class: Stream added:18 methods comment/format in:11 methods easy to use MSB/LSB readers/writers.
Stream.st
--- a/Stream.st	Tue Apr 19 14:56:22 2016 +0200
+++ b/Stream.st	Tue Apr 19 16:43:19 2016 +0200
@@ -1033,6 +1033,20 @@
     ^ ShortFloat readBinaryIEEESingleFrom:self MSB:msbFirst
 !
 
+nextInt16LSB
+    "return a signed short (2 bytes) in LSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextInt16MSB:false
+!
+
+nextInt16MSB
+    "return a signed short (2 bytes) in MSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextInt16MSB:true
+!
+
 nextInt16MSB:msbFlag
     "return a signed short (2 bytes) from the stream.
      The receiver must support reading of binary bytes.
@@ -1071,7 +1085,7 @@
 nextInt16Net
     "return a signed short (2 bytes) in network byte order from the stream.
      The receiver must support reading of binary bytes.
-     Network byte order is MSB per definition"
+     Network byte order is MSB-first per definition"
 
     ^ self nextInt16MSB:true
 
@@ -1108,6 +1122,20 @@
     "
 !
 
+nextInt32LSB
+    "return a signed long (4 bytes) in LSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextInt32MSB:false
+!
+
+nextInt32MSB
+    "return a signed long (4 bytes) in MSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextInt32MSB:true
+!
+
 nextInt32MSB:msbFlag
     "return a signed long (4 bytes) from the stream.
      The receiver must support reading of binary bytes.
@@ -1172,15 +1200,30 @@
 
 nextInt32Net
     "return a signed long (4 bytes) in network byte order from the stream.
-     The receiver must support reading of binary bytes."
+     The receiver must support reading of binary bytes.
+     Network byte order is MSB-first per definition"
 
     ^ self nextInt32MSB:true
 
     "Created: 10.1.1996 / 19:49:28 / cg"
 !
 
+nextInt64LSB
+    "return a signed longlong (also called hyper) (8 bytes) in LSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextInt64MSB:false
+!
+
+nextInt64MSB
+    "return a signed longlong (also called hyper) (8 bytes) in MSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextInt64MSB:true
+!
+
 nextInt64MSB:msbFlag
-    "return a signed hyper (8 bytes) from the stream.
+    "return a signed longlong (also called hyper) (8 bytes) from the stream.
      The receiver must support reading of binary bytes.
 
      The msbFlag argument controls if the integer is to be read with
@@ -1233,8 +1276,9 @@
 !
 
 nextInt64Net
-    "return a signed longlong (8 bytes) in network byte order from the stream.
-     The receiver must support reading of binary bytes."
+    "return a signed longlong (also called hyper) (8 bytes) in network byte order from the stream.
+     The receiver must support reading of binary bytes.
+     Network byte order is MSB-first per definition"
 
     ^ self nextInt64MSB:true
 !
@@ -1386,6 +1430,20 @@
     "Modified: / 14.1.1998 / 15:40:41 / cg"
 !
 
+nextUnsignedInt16LSB
+    "return an unsigned short (2 bytes) in LSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextUnsignedInt16MSB:false
+!
+
+nextUnsignedInt16MSB
+    "return an unsigned short (2 bytes) in MSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextUnsignedInt16MSB:true
+!
+
 nextUnsignedInt16MSB:msbFlag
     "return an unsigned short (2 bytes) from the stream.
      The receiver must support reading of binary bytes.
@@ -1423,7 +1481,7 @@
 nextUnsignedInt16Net
     "return an unsigned short (2 bytes) in network byte order from the stream.
      The receiver must support reading of binary bytes.
-     Network byte order is MSB per definition"
+     Network byte order is MSB-first per definition"
 
     ^ self nextUnsignedInt16MSB:true
 
@@ -1465,6 +1523,20 @@
     "
 !
 
+nextUnsignedInt32LSB
+    "return an unsigned long (4 bytes) in LSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextUnsignedInt32MSB:false
+!
+
+nextUnsignedInt32MSB
+    "return an unsigned long (4 bytes) in MSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextUnsignedInt32MSB:true
+!
+
 nextUnsignedInt32MSB:msbFlag
     "return an unsigned long (4 bytes) from the stream.
      The receiver must support reading of binary bytes.
@@ -1502,7 +1574,8 @@
 
 nextUnsignedInt32Net
     "return an unsigned long (4 bytes) in network byte order from the stream.
-     The receiver must support reading of binary bytes."
+     The receiver must support reading of binary bytes.
+     Network byte order is MSB-first per definition"
 
     ^ self nextUnsignedInt32MSB:true
 
@@ -1510,8 +1583,22 @@
     "Modified: 10.1.1996 / 19:49:50 / cg"
 !
 
+nextUnsignedInt64LSB
+    "return an unsigned longlong (also called hyper) (8 bytes) in LSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextUnsignedInt64MSB:false
+!
+
+nextUnsignedInt64MSB
+    "return an unsigned longlong (also called hyper) (8 bytes) in MSB-first order from the stream.
+     The receiver must support reading of binary bytes."
+
+    ^ self nextUnsignedInt64MSB:true
+!
+
 nextUnsignedInt64MSB:msbFlag
-    "return an unsigned hyper (8 bytes) from the stream.
+    "return an unsigned longlong (also called hyper) (8 bytes) from the stream.
      The receiver must support reading of binary bytes.
 
      The msbFlag argument controls if the integer is to be read with
@@ -1574,8 +1661,9 @@
 !
 
 nextUnsignedInt64Net
-    "return an unsigned longlong (8 bytes) in network byte order from the stream.
-     The receiver must support reading of binary bytes."
+    "return an unsigned longlong (also called hyper) (8 bytes) in network byte order from the stream.
+     The receiver must support reading of binary bytes.
+     Network byte order is MSB-first per definition"
 
     ^ self nextUnsignedInt64MSB:true
 ! !
@@ -2089,11 +2177,27 @@
     "Modified: / 22-06-2006 / 11:30:26 / fm"
 !
 
+nextPutInt16LSB:aNumber
+    "Write the argument, aNumber as a short (two bytes) in LSB-first order.
+     Returns the receiver on ok, nil on error.
+     The receiver must support writing of binary bytes."
+
+    ^ self nextPutInt16:aNumber MSB:false.
+!
+
+nextPutInt16MSB:aNumber
+    "Write the argument, aNumber as a short (two bytes) in MSB-first order.
+     Returns the receiver on ok, nil on error.
+     The receiver must support writing of binary bytes."
+
+    ^ self nextPutInt16:aNumber MSB:true.
+!
+
 nextPutInt16Net:aNumber
     "Write the argument, aNumber as a short (two bytes) in the network byte order.
      Returns the receiver on ok, nil on error.
      The receiver must support writing of binary bytes.
-     Network byte order is MSB per definition"
+     Network byte order is MSB-first per definition"
 
     ^ self nextPutInt16:aNumber MSB:true.
 
@@ -2179,10 +2283,27 @@
     "Modified: / 22-06-2006 / 11:31:43 / fm"
 !
 
+nextPutInt32LSB:aNumber
+    "Write the argument, aNumber as a long (4 bytes) in LSB-first order.
+     Returns the receiver on ok, nil on error.
+     The receiver must support writing of binary bytes."
+
+    ^ self nextPutInt32:aNumber MSB:false.
+!
+
+nextPutInt32MSB:aNumber
+    "Write the argument, aNumber as a long (4 bytes) in MSB-first order.
+     Returns the receiver on ok, nil on error.
+     The receiver must support writing of binary bytes."
+
+    ^ self nextPutInt32:aNumber MSB:true.
+!
+
 nextPutInt32Net:aNumber
     "Write the argument, aNumber as a long (four bytes) in the network byte order.
      Returns the receiver on ok, nil on error.
-     The receiver must support writing of binary bytes."
+     The receiver must support writing of binary bytes.
+     Network byte order is MSB-first per definition"
 
     ^ self nextPutInt32:aNumber MSB:true
 !
@@ -2251,10 +2372,27 @@
     "Modified: / 22-06-2006 / 11:31:37 / fm"
 !
 
+nextPutInt64LSB:aNumber
+    "Write the argument, aNumber as a longlong (8 bytes) in LSB-first order.
+     Returns the receiver on ok, nil on error.
+     The receiver must support writing of binary bytes."
+
+    ^ self nextPutInt64:aNumber MSB:false.
+!
+
+nextPutInt64MSB:aNumber
+    "Write the argument, aNumber as a longlong (8 bytes) in MSB-first order.
+     Returns the receiver on ok, nil on error.
+     The receiver must support writing of binary bytes."
+
+    ^ self nextPutInt64:aNumber MSB:true.
+!
+
 nextPutInt64Net:aNumber
     "Write the argument, aNumber as a longlong (8 bytes) in the network byte order.
      Returns the receiver on ok, nil on error.
-     The receiver must support writing of binary bytes."
+     The receiver must support writing of binary bytes.
+     Network byte order is MSB-first per definition"
 
     ^ self nextPutInt64:aNumber MSB:true
 !