PositionableStream.st
branchjv
changeset 18084 ab5b38bd8f81
parent 18066 89d51443ba6f
parent 15640 d5a8c24894e2
child 18120 e3a375d5f6a8
--- a/PositionableStream.st	Mon Aug 19 23:30:27 2013 +0100
+++ b/PositionableStream.st	Tue Aug 20 00:07:19 2013 +0100
@@ -141,7 +141,6 @@
     "
 ! !
 
-
 !PositionableStream methodsFor:'accessing'!
 
 collection
@@ -230,34 +229,37 @@
 !
 
 position
-    "return the read position"
-
-    ^ self position0Based
-!
-
-position0Based
-    "return the read position 0-based"
+    "return the read position (0-based)"
 
     ^ position
 !
 
+position0Based
+    <resource: #obsolete>
+    "return the read position 0-based"
+
+    ^ self position
+!
+
 position0Based:index0Based
+    <resource: #obsolete>
     "set the read (or write) position"
 
-    ((index0Based > readLimit) or:[index0Based < 0]) ifTrue: [^ self positionError:index0Based].
-    position := index0Based
+    self position:index0Based
 !
 
 position1Based
+    <resource: #obsolete>
     "return the read position 1-based"
 
-    ^ self position0Based + 1
+    ^ self position + 1
 !
 
 position1Based:index1Based
+    <resource: #obsolete>
     "set the read (or write) position"
 
-    self position0Based:(index1Based - 1)
+    self position:(index1Based - 1)
 
     "
      |s|
@@ -289,39 +291,11 @@
     "
 !
 
-position:newPos
+position:index0Based
     "set the read (or write) position"
 
-    ^ self position0Based:newPos
-
-    "
-     |s|
-
-     s := '1234567890' readStream.
-     s next:5.
-     s position:1.
-     s next:7.       
-    "
-
-    "
-     |s|
-
-     s := '' writeStream.
-     s nextPutAll:'1234567890'.
-     s position:5.
-     s nextPutAll:'abcdefg'.
-     s contents 
-    "
-
-    "
-     |s|
-
-     s := '' writeStream.
-     s nextPutAll:'1234567890'.
-     s position:0.
-     s nextPutAll:'abcdefg'.
-     s contents 
-    "
+    ((index0Based > readLimit) or:[index0Based < 0]) ifTrue: [^ self positionError:index0Based].
+    position := index0Based
 !
 
 reset
@@ -492,7 +466,7 @@
 contentsSpecies
     "return a class of which instances will be returned, when
      parts of the collection are asked for. 
-     (see upTo-kind of methods in subclasses)"
+     (see upTo-kind of methods in Stream)"
 
     ^ collection species
 !
@@ -659,11 +633,11 @@
 !PositionableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.159 2013-06-03 18:39:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.161 2013-08-18 10:56:02 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.159 2013-06-03 18:39:54 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.161 2013-08-18 10:56:02 cg Exp $'
 ! !