--- a/Stream.st Tue Dec 03 16:54:12 2013 +0000
+++ b/Stream.st Thu Dec 05 09:52:02 2013 +0000
@@ -194,6 +194,9 @@
^ ChunkSeparator
! !
+
+
+
!Stream methodsFor:'accessing'!
contents
@@ -746,14 +749,14 @@
"return the next byte of the stream
- we do not know here how to do it, it should be redefined in subclass"
- ^ self next
+ ^ self next asInteger
!
nextBytes:count
"read the next count bytes and return it as a byteArray.
If EOF is encountered while reading, a truncated byteArray is returned.
If EOF is already reached before the first byte can be read,
- nil is returned."
+ an error is raised."
|data n|
@@ -761,7 +764,7 @@
n := self nextBytes:count into:data startingAt:1.
n ~~ count ifTrue:[
n == 0 ifTrue:[
- ^ nil
+ ^ self pastEndRead.
].
data := data copyTo:n
].
@@ -803,27 +806,22 @@
streams."
|n "{Class: SmallInteger }"
- dstIndex binary b|
+ dstIndex|
+
+ numBytes == 0 ifTrue:[
+ ^ 0.
+ ].
dstIndex := initialIndex.
n := 0.
- binary := self isBinary.
[self atEnd] whileFalse:[
+ aCollection byteAt:dstIndex put:self nextByte.
+ n := n + 1.
n == numBytes ifTrue:[
^ n
].
- binary ifTrue:[
- b := self nextByte.
- ] ifFalse:[
- b := self next.
- b isInteger ifFalse:[
- b := b asInteger
- ].
- ].
- aCollection byteAt:dstIndex put:b.
dstIndex := dstIndex + 1.
- n := n + 1.
].
^ n
@@ -3491,11 +3489,11 @@
!Stream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.211 2013-10-12 19:16:20 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.212 2013-12-02 19:05:57 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.211 2013-10-12 19:16:20 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Stream.st,v 1.212 2013-12-02 19:05:57 stefan Exp $'
! !