Hi Monty,
> On 18 Jun 2018, at 23:43, monty <[email protected]> wrote:
>
> They still use (binary) StandardFileStreams on Pharo and Squeak. But since
> it's done through dynamically chosen file stream factory classes
> (XMLFileReadStreamFactory and XMLFileWriteStreamFactory), it's easy add
> support for other stream classes. (The GemStone compat .mcz adds factories
> for GsFile read/write factories, for example).
>
> #preferredImplementation selects which implementation to use in the hierarchy
> when there's more than one supported (#isSupportedImplementation).
> ___
> montyos.wordpress.com
>
>
>> Sent: Monday, June 18, 2018 at 1:34 AM
>> From: "Sven Van Caekenberghe" <[email protected]>
>> To: "Any question about pharo is welcome" <[email protected]>
>> Subject: Re: [Pharo-users] Lost in stream
>>
>>
>>
>>> On 18 Jun 2018, at 02:18, monty <[email protected]> wrote:
>>>
>>> Also consider using XMLParser's built-in file reading support:
>>> #parseFileNamed:/#onFileNamed:. They work cross platform (Squeak, GS), and
>>> handle character decoding.
>>
>> Monty, do these (already) work with all the latest changes in Pharo 7, I
>> mean the deprecation of FileStream and subclasses as well as
>> [RW|MultiByte]BinaryOrTextStream for FileReference, File and Zn streams ?
>>
>> If not, we should help you.
>>
>> Sven
>>
>
Here is an attempt at an implementation (untested):
Change
XMLStandardFileStream[Read|Write]StreamFactory class>>isSupportedImplementation
^ (XMLClassFinder hasClassNamed: #StandardFileStream)
and: [ (XMLClassFinder classNamed: #StandardFileStream)
isDeprecated not ]
New
subclasses XMLPharoFile[Read|Write]StreamFactory
XMLPharoFile[Read|Write]StreamFactory class>>#isSupportedImplementation
^ (XMLClassFinder hasClassNamed: #File)
and: [ (XMLClassFinder classNamed: #FileStream) isDeprecated ]
XMLPharoFileReadStreamFactory class>>basicOnPath: aPathString
^ aPathString asFileReference binaryReadStream
XMLPharoFileWriteStreamFactory class>>basicOnPath: aPathString
^ aPathString asFileName ensureDelete binaryWriteStream
File and FileStream have existed in Pharo for quite a while, it is only after
FileStream and subclasses where deprecated that we can speak of a real switch.
You also have XMLFileSystemFileHandle that could be used directly, I guess. But
you pass on paths as strings, so if you want to keep that, the above should
work AFAIKT.
Regards,
Sven