Skip to content

Limited compatibility with FileStream #13

@LinqLover

Description

@LinqLover

We noticed several compatibility issues that severely limit the applicability of FS in Squeak:

  • Different behavior of next: In Squeak's Files package, it answers nil when at the end of the stream. FS raises an error.

    e.g., this makes it incompatible with Json:

    FileSystem memory in: [:fs |
    	fs / 'test.txt'
    		writeStreamDo: [:s |
    			'squeak' jsonWriteOn: s];
    		readStreamDo: [:s |
    			Json readFrom: s]] "⚡ Error: subscript is out of bounds: 8"
  • No single-byte file stream option: In the Files package, StandardFileStream reads files byte per byte as opposed to MultiByteFileStream which uses a converter. All FSStreams require the use of a converter. Since there seems not to be something as a null converter (?), this makes it impossible to read files that were written using StandardFileStream.

  • basicBack is missing on FSReadStream which is sent from UTF8TextConverter in response to #skip:. E.g.:

    FileSystem memory in: [:fs |
    	fs / 'test.txt'
    		writeStreamDo: [:s |
    			'squeak' jsonWriteOn: s.
    			s nextPut: Character null];
    		readStreamDo: [:s |
    			Json readFrom: s]] "⚡ MNU: #basicBack"

    Does this implementation make sense?

    FSReadStream>>basicBack
    	| result |
    	result := handle at: position - 1.
    	position := position - 1.
    	isBinary ifFalse: [result := result asCharacter].
     	^ result
  • No support for data get/put protocol which limits usage for Sounds and others. See hpi-swa/Squot@4b35071 for more details. /cc @MariusDoe

In general, the question remains how much compatibility is desired ... but I would like it ... :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions