FileStream.st
changeset 23165 0a6eb6d342d8
parent 23045 774a133e168c
child 23166 787731fd16e1
--- a/FileStream.st	Sun Jul 01 11:10:34 2018 +0200
+++ b/FileStream.st	Sun Jul 01 12:46:21 2018 +0200
@@ -706,6 +706,15 @@
     "return a readonly FileStream for the existing file named filename, aString."
 
     ^ self readonlyFileNamed:filename
+!
+
+readOnlyFileNamed:filename do:aBlock
+    "open a readonly stream on filename and evaluate aBlock with it.
+     Ensures that the stream is closed afterwards"
+
+    ^ filename asFilename readingFileDo:aBlock
+
+    "Created: / 01-07-2018 / 12:45:19 / Claus Gittinger"
 ! !
 
 !FileStream class methodsFor:'Compatibility-VW'!