From 02fa5ed7cc720af09f0930a3670be60a17979141 Mon Sep 17 00:00:00 2001 From: Torsten Bergmann Date: Tue, 28 May 2024 22:30:36 +0200 Subject: [PATCH] Fix #10 --- ...aroFileReferenceReadStreamFactory.class.st | 20 +++++++++++++++++++ ...roFileReferenceWriteStreamFactory.class.st | 20 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/XML-Parser/XMLPharoFileReferenceReadStreamFactory.class.st create mode 100644 src/XML-Parser/XMLPharoFileReferenceWriteStreamFactory.class.st diff --git a/src/XML-Parser/XMLPharoFileReferenceReadStreamFactory.class.st b/src/XML-Parser/XMLPharoFileReferenceReadStreamFactory.class.st new file mode 100644 index 00000000..a43dd985 --- /dev/null +++ b/src/XML-Parser/XMLPharoFileReferenceReadStreamFactory.class.st @@ -0,0 +1,20 @@ +" +A StandardFileStream read stream factory. This stream is preferred for Squeak/Pharo because it does no decoding and returns byte characters so XMLParser can do its own decoding. +" +Class { + #name : 'XMLPharoFileReferenceReadStreamFactory', + #superclass : 'XMLFileReadStreamFactory', + #category : 'XML-Parser-Files', + #package : 'XML-Parser', + #tag : 'Files' +} + +{ #category : 'basic' } +XMLPharoFileReferenceReadStreamFactory class >> basicOnPath: aPathString [ + ^ aPathString asFileReference ensureCreateFile binaryReadStream +] + +{ #category : 'testing' } +XMLPharoFileReferenceReadStreamFactory class >> isSupportedImplementation [ + ^ XMLClassFinder hasClassNamed: #ZnBufferedReadStream +] diff --git a/src/XML-Parser/XMLPharoFileReferenceWriteStreamFactory.class.st b/src/XML-Parser/XMLPharoFileReferenceWriteStreamFactory.class.st new file mode 100644 index 00000000..f980c263 --- /dev/null +++ b/src/XML-Parser/XMLPharoFileReferenceWriteStreamFactory.class.st @@ -0,0 +1,20 @@ +" +A StandardFileStream write stream factory. This stream is preferred for Pharo/Squeak because it does no encoding and accepts byte characters so XMLParser can do its own encoding. +" +Class { + #name : 'XMLPharoFileReferenceWriteStreamFactory', + #superclass : 'XMLFileWriteStreamFactory', + #category : 'XML-Parser-Files', + #package : 'XML-Parser', + #tag : 'Files' +} + +{ #category : 'basic' } +XMLPharoFileReferenceWriteStreamFactory class >> basicOnPath: aPathString [ + ^ aPathString asFileReference ensureCreateFile binaryWriteStream +] + +{ #category : 'testing' } +XMLPharoFileReferenceWriteStreamFactory class >> isSupportedImplementation [ + ^ XMLClassFinder hasClassNamed: #ZnBufferedWriteStream +]