--- a/ReadStr.st Fri Sep 13 11:58:39 1996 +0200
+++ b/ReadStr.st Fri Sep 13 18:49:38 1996 +0200
@@ -83,6 +83,12 @@
isReadable
^ true
+!
+
+size
+ ^ collection size
+
+ "Created: 13.9.1996 / 18:14:35 / cg"
! !
!ReadStream methodsFor:'reading'!
@@ -204,6 +210,21 @@
^ super nextAlphaNumericWord
!
+nextByte
+ "return the next element as a byteValued integer"
+
+ |ret|
+
+ ret := self next.
+ ((ret < 0) or:[ret > 255]) ifTrue:[
+ self error:'oops - not a byte value in stream'.
+ ^ nil
+ ].
+ ^ ret
+
+ "Created: 13.9.1996 / 18:10:38 / cg"
+!
+
nextDecimalInteger
"read the next integer in radix 10. dont skip whitespace.
- tuned for speed on String-Streams for faster scanning"
@@ -551,5 +572,5 @@
!ReadStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/ReadStr.st,v 1.30 1996-06-26 07:37:38 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/ReadStr.st,v 1.31 1996-09-13 16:49:38 cg Exp $'
! !
--- a/ReadStream.st Fri Sep 13 11:58:39 1996 +0200
+++ b/ReadStream.st Fri Sep 13 18:49:38 1996 +0200
@@ -83,6 +83,12 @@
isReadable
^ true
+!
+
+size
+ ^ collection size
+
+ "Created: 13.9.1996 / 18:14:35 / cg"
! !
!ReadStream methodsFor:'reading'!
@@ -204,6 +210,21 @@
^ super nextAlphaNumericWord
!
+nextByte
+ "return the next element as a byteValued integer"
+
+ |ret|
+
+ ret := self next.
+ ((ret < 0) or:[ret > 255]) ifTrue:[
+ self error:'oops - not a byte value in stream'.
+ ^ nil
+ ].
+ ^ ret
+
+ "Created: 13.9.1996 / 18:10:38 / cg"
+!
+
nextDecimalInteger
"read the next integer in radix 10. dont skip whitespace.
- tuned for speed on String-Streams for faster scanning"
@@ -551,5 +572,5 @@
!ReadStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.30 1996-06-26 07:37:38 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.31 1996-09-13 16:49:38 cg Exp $'
! !
--- a/Stream.st Fri Sep 13 11:58:39 1996 +0200
+++ b/Stream.st Fri Sep 13 18:49:38 1996 +0200
@@ -315,6 +315,15 @@
with externalStreams."
"Modified: 15.5.1996 / 17:38:36 / cg"
+!
+
+text
+ "switch to text mode.
+ Ignored here, but added to make internalStreams protocol compatible
+ with externalStreams."
+
+ "Modified: 15.5.1996 / 17:38:36 / cg"
+ "Created: 13.9.1996 / 18:33:26 / cg"
! !
!Stream methodsFor:'non homogenous reading'!
@@ -369,6 +378,31 @@
"Modified: 15.5.1996 / 17:51:42 / cg"
!
+nextBytes:numBytes into:aCollection
+ "return the next numBytes from the stream.
+ The receiver must support reading of binary bytes."
+
+ ^ self nextBytes:numBytes into:aCollection startingAt:1
+
+ "Modified: 13.9.1996 / 18:13:01 / cg"
+!
+
+nextBytes:numBytes into:aCollection startingAt:initialIndex
+ "return the next numBytes from the stream.
+ The receiver must support reading of binary bytes."
+
+ |dstIndex|
+
+ dstIndex := initialIndex.
+ 1 to:numBytes do:[:index |
+ aCollection at:dstIndex put:(self nextByte).
+ dstIndex := dstIndex + 1.
+ ].
+ ^ numBytes
+
+ "Created: 13.9.1996 / 18:12:47 / cg"
+!
+
nextLine
"return the characters upTo (but excluding) the next cr (carriage return)
character (i.e. read a single line of text).
@@ -1466,6 +1500,6 @@
!Stream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.50 1996-07-15 07:08:44 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.51 1996-09-13 16:49:24 cg Exp $'
! !
Stream initialize!