--- a/ReadStream.st Mon Jun 06 10:37:21 2016 +0100
+++ b/ReadStream.st Mon Jun 06 10:56:12 2016 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1988 by Claus Gittinger
All Rights Reserved
@@ -73,8 +75,8 @@
next: n into: aCollection startingAt: startIndex
"Read n objects into the given collection.
- Return aCollection or a partial copy if less than
- n elements have been read."
+ Return aCollection or a partial copy if less than
+ n elements have been read."
| max |
@@ -259,20 +261,22 @@
|answer|
- self contentsSpecies == collection class ifTrue:[
- ((position + count) > readLimit) ifFalse:[
- answer := collection copyFrom:position+1 to:position+count.
- position := position+count.
- ^ answer
- ].
+ collection notNil ifTrue:[
+ self contentsSpecies == collection class ifTrue:[
+ ((position + count) > readLimit) ifFalse:[
+ answer := collection copyFrom:position+1 to:position+count.
+ position := position+count.
+ ^ answer
+ ].
+ ].
].
^ super next:count
"
#[1 2 3 4 5 6 7 8 9] readStream
- next;
- next:5;
- next.
+ next;
+ next:5;
+ next.
"
!