AbstractSourceFileReader.st
changeset 23521 74d847ad5d1e
parent 21454 7c6e37a93527
equal deleted inserted replaced
23520:2ececed7e107 23521:74d847ad5d1e
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2009 by Claus Gittinger / eXept Software AG
     4  COPYRIGHT (c) 2009 by Claus Gittinger / eXept Software AG
     3               All Rights Reserved
     5               All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
    65 ! !
    67 ! !
    66 
    68 
    67 !AbstractSourceFileReader methodsFor:'fileIn'!
    69 !AbstractSourceFileReader methodsFor:'fileIn'!
    68 
    70 
    69 fileIn:aFilename
    71 fileIn:aFilename
    70 
    72     aFilename asFilename readingFileDo:[:stream |
    71     | stream |
    73         self fileInStream: stream
    72     [stream := aFilename asFilename readStream.
    74     ]
    73     self fileInStream: stream]
       
    74         ensure:
       
    75             [stream notNil ifTrue:[stream close]]
       
    76 
    75 
    77     "Modified: / 15-08-2009 / 14:47:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
    76     "Modified: / 15-08-2009 / 14:47:29 / Jan Vrany <vranyj1@fel.cvut.cz>"
    78     "Modified: / 08-08-2010 / 14:38:35 / cg"
    77     "Modified: / 08-08-2010 / 14:38:35 / cg"
       
    78     "Modified: / 07-11-2018 / 22:22:35 / Claus Gittinger"
    79 !
    79 !
    80 
    80 
    81 fileInStream:arg
    81 fileInStream:arg
    82     "raise an error: must be redefined in concrete subclass(es)"
    82     "raise an error: must be redefined in concrete subclass(es)"
    83 
    83