PositionableStream.st
changeset 6314 e1aad938d629
parent 6230 877a8da90c7c
child 6361 93376085b2df
--- a/PositionableStream.st	Thu Dec 13 19:53:43 2001 +0100
+++ b/PositionableStream.st	Thu Dec 13 20:00:33 2001 +0100
@@ -72,9 +72,10 @@
         ErrorDuringFileInSignal nameClass:self message:#errorDuringFileInSignal.
         ErrorDuringFileInSignal notifierString:'error during fileIn'.
 
-        InvalidPositionErrorSignal := PositionErrorSignal newSignalMayProceed:true.
-        InvalidPositionErrorSignal nameClass:self message:#invalidPositionErrorSignal.
-        InvalidPositionErrorSignal notifierString:'invalid position'.
+"/        InvalidPositionErrorSignal := PositionErrorSignal newSignalMayProceed:true.
+"/        InvalidPositionErrorSignal nameClass:self message:#invalidPositionErrorSignal.
+        InvalidPositionErrorSignal := PositionOutOfBoundsError.
+        InvalidPositionErrorSignal notifierString:'position out of bounds: '.
 
         CurrentFileInDirectoryQuerySignal := QuerySignal new.
         CurrentFileInDirectoryQuerySignal nameClass:self message:#currentFileInDirectoryQuerySignal.
@@ -83,7 +84,6 @@
 
         ZeroPosition := 1.
     ]
-
 ! !
 
 !PositionableStream class methodsFor:'instance creation'!
@@ -799,7 +799,7 @@
     "/ FIX: allow positioning right after last element of stream
     "/ ((index > readLimit) or:[index < 0]) ifTrue: [^ self positionError].
 
-    ((index > (readLimit+1)) or:[index < ZeroPosition]) ifTrue: [^ self positionError].
+    ((index > (readLimit+1)) or:[index < ZeroPosition]) ifTrue: [^ self positionError:index].
     position := index
 
     "
@@ -995,6 +995,15 @@
     "Modified: / 26.7.1999 / 10:59:13 / stefan"
 !
 
+positionError:badPostition
+    "{ Pragma: +optSpace }"
+
+    "report an error when positioning past the end
+     or before the beginning."
+
+    ^ InvalidPositionErrorSignal raiseRequestWith:badPostition
+!
+
 with:aCollection
     "setup for streaming to the end of aCollection"
 
@@ -1080,6 +1089,6 @@
 !PositionableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.105 2001-11-21 15:04:10 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.106 2001-12-13 19:00:33 cg Exp $'
 ! !
 PositionableStream initialize!