equal
deleted
inserted
replaced
950 ! |
950 ! |
951 |
951 |
952 resetPosition |
952 resetPosition |
953 "set the read position to the beginning of the collection" |
953 "set the read position to the beginning of the collection" |
954 |
954 |
955 position := self class zeroPosition |
955 position := ZeroPosition |
956 |
956 |
957 " |
957 " |
958 |s| |
958 |s| |
959 |
959 |
960 s := 'hello world' readStream. |
960 s := 'hello world' readStream. |
965 ! |
965 ! |
966 |
966 |
967 setToEnd |
967 setToEnd |
968 "set the read position to the end of the collection" |
968 "set the read position to the end of the collection" |
969 |
969 |
970 position := readLimit |
970 position := readLimit - 1 + ZeroPosition |
971 ! |
971 ! |
972 |
972 |
973 skip:numberToSkip |
973 skip:numberToSkip |
974 "skip the next numberToSkip elements" |
974 "skip the next numberToSkip elements" |
975 |
975 |
1072 on:aCollection |
1072 on:aCollection |
1073 "setup for streaming on aCollection" |
1073 "setup for streaming on aCollection" |
1074 |
1074 |
1075 collection := aCollection. |
1075 collection := aCollection. |
1076 readLimit := aCollection size. |
1076 readLimit := aCollection size. |
1077 position := "0" 1 |
1077 position := ZeroPosition |
1078 ! |
1078 ! |
1079 |
1079 |
1080 on:aCollection from:first to:last |
1080 on:aCollection from:first to:last |
1081 "setup for streaming on aCollection from first to last" |
1081 "setup for streaming on aCollection from first to last" |
1082 |
1082 |
1083 collection := aCollection. |
1083 collection := aCollection. |
1084 position := first. |
1084 position := first - 1 + ZeroPosition. |
1085 readLimit := last |
1085 readLimit := last |
1086 ! |
1086 ! |
1087 |
1087 |
1088 positionError |
1088 positionError |
1089 "{ Pragma: +optSpace }" |
1089 "{ Pragma: +optSpace }" |
1179 !PositionableStream methodsFor:'testing'! |
1179 !PositionableStream methodsFor:'testing'! |
1180 |
1180 |
1181 atEnd |
1181 atEnd |
1182 "return true, if the read-position is at the end" |
1182 "return true, if the read-position is at the end" |
1183 |
1183 |
1184 ^ position > readLimit |
1184 ^ (position - ZeroPosition + 1) > readLimit |
1185 ! |
1185 ! |
1186 |
1186 |
1187 isEmpty |
1187 isEmpty |
1188 "return true, if the contents of the stream is empty" |
1188 "return true, if the contents of the stream is empty" |
1189 |
1189 |
1191 ! ! |
1191 ! ! |
1192 |
1192 |
1193 !PositionableStream class methodsFor:'documentation'! |
1193 !PositionableStream class methodsFor:'documentation'! |
1194 |
1194 |
1195 version |
1195 version |
1196 ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.124 2003-03-02 20:38:24 stefan Exp $' |
1196 ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.125 2003-03-17 16:46:27 cg Exp $' |
1197 ! ! |
1197 ! ! |
1198 |
1198 |
1199 PositionableStream initialize! |
1199 PositionableStream initialize! |