--- a/PositionableStream.st Mon Jun 03 19:46:10 2013 +0200
+++ b/PositionableStream.st Mon Jun 03 19:48:26 2013 +0200
@@ -230,24 +230,20 @@
position
"return the read position"
- ZeroPosition == 0 ifTrue:[
- ^ self position0Based
- ] ifFalse:[
- ^ self position1Based
- ].
+ ^ self position0Based
!
position0Based
"return the read position 0-based"
- ^ position - ZeroPosition
+ ^ position
!
position0Based:index0Based
"set the read (or write) position"
((index0Based > readLimit) or:[index0Based < 0]) ifTrue: [^ self positionError:index0Based].
- position := index0Based + ZeroPosition
+ position := index0Based
!
position1Based
@@ -294,11 +290,7 @@
position:newPos
"set the read (or write) position"
- ZeroPosition == 0 ifTrue:[
- ^ self position0Based:newPos
- ] ifFalse:[
- ^ self position1Based:newPos
- ].
+ ^ self position0Based:newPos
"
|s|
@@ -348,7 +340,7 @@
resetPosition
"set the read position to the beginning of the collection"
- position := ZeroPosition
+ position := 0
"
|s|
@@ -365,7 +357,7 @@
#next will return EOF, #nextPut: will append to the stream.
(same Behavior as FileStream."
- position := readLimit + ZeroPosition
+ position := readLimit
!
skip:numberToSkip
@@ -511,14 +503,14 @@
readLimit == 0 ifTrue:[
self assert:(aCollection isCollection)
].
- position := ZeroPosition
+ position := 0
!
on:aCollection from:first to:last
"setup for streaming on aCollection from first to last"
collection := aCollection.
- position := first - 1 + ZeroPosition.
+ position := first - 1.
readLimit := last
!
@@ -562,11 +554,11 @@
|end result|
end := position + count.
- (end - ZeroPosition + 1) > readLimit ifTrue:[
+ (end + 1) > readLimit ifTrue:[
end := readLimit.
].
- result := collection copyFrom:position+1-ZeroPosition to:end.
+ result := collection copyFrom:position+1 to:end.
position := end.
^ result.
@@ -639,7 +631,7 @@
atEnd
"return true, if the read-position is at the end"
- ^ (position - ZeroPosition + 1) > readLimit
+ ^ (position + 1) > readLimit
!
isEmpty
@@ -665,11 +657,11 @@
!PositionableStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.156 2013-04-25 13:09:40 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.157 2013-06-03 17:48:26 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.156 2013-04-25 13:09:40 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.157 2013-06-03 17:48:26 cg Exp $'
! !