Issue 4797 in pharo: FS readStream writeStream problem

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 4797 in pharo: FS readStream writeStream problem

pharo
Status: Accepted
Owner: [hidden email]

New issue 4797 by [hidden email]: FS readStream writeStream problem
http://code.google.com/p/pharo/issues/detail?id=4797

If you fill an issue for the first time, please read "How to report bugs"
at http://www.pharo-project.org/community/issue-tracking

Pharo image: <core, dev or web>
Pharo core version: <copy from World/System/About>
Virtual machine used: <ex: pharo-vm-0.15.2f-linux>
Class browser used if applicable: <ex: O2PackageBrowserAdaptor. If you
don't
know, print "SystemBrowser default">

Steps to reproduce:
1.
2.
3.


Paste or attach stack trace if applicable (look at the file PharoDebug.log
located in the same directory as your image):



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4797 in pharo: FS readStream writeStream problem

pharo

Comment #1 on issue 4797 by [hidden email]: FS readStream  
writeStream problem
http://code.google.com/p/pharo/issues/detail?id=4797

| working stream |
working := FSFilesystem disk workingDirectory.
stream := (working / 'foo.txt') writeStream.
stream nextPutAll: 'Hello World'.
stream close.
stream := (working / 'foo.txt') readStream.
stream contents.
      returns
      #[72 101 108 108 111 32 87 111 114 108 100]


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4797 in pharo: FS readStream writeStream problem

pharo

Comment #2 on issue 4797 by [hidden email]: FS readStream  
writeStream problem
http://code.google.com/p/pharo/issues/detail?id=4797

On 13 September 2011 16:41, Lukas Renggli <[hidden email]> wrote:
Then you also need to specify an encoding. Otherwise it does not make
sense for a FSReadStream to return a String.

Strictly speaking the FSWriteStream shouldn't accept a String as input  
either.


+1000

there should be a clear separation between binary and text.
I think that mixing the code for text and binary modes in single class
is a source of errors and confusion.

The code:

stream := (working / 'foo.txt') writeStream.

should be something like:


stream := (working / 'foo.txt') writeStream textStream.

where textStream should answer the wrapper stream around the original
stream, something like:

textStream
   ^ UnicodeTextWriteStream on: self


then when you do:

stream nextPutAll: 'abc'

the wrapper stream takes care about converting input string into
bytearray and then passing it further to basic stream.
Of course there could be an optimization, if input string are
bytestring etc , but model should be separated.



_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4797 in pharo: FS readStream writeStream problem

pharo
Updates:
        Labels: Type-Bug

Comment #3 on issue 4797 by [hidden email]: FS readStream  
writeStream problem
http://code.google.com/p/pharo/issues/detail?id=4797

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4797 in pharo: FS readStream writeStream problem

pharo

Comment #4 on issue 4797 by [hidden email]: FS readStream  
writeStream problem
http://code.google.com/p/pharo/issues/detail?id=4797

in Pharo 1.4-14225 - latest cog engine - test of the following methods  
issue failures:
#readStream
#readStremDo:

anyway:
I think they could be deprecated, because #fileStreamDo: is working fine

#readXXX seems to work for strings
#fileStreamXXX in any case

but if for compatibility reasons #readXXX is desirable
invocation for other types should be cognized
possibly issuing a deprecate msg informing the programmer to use  
#fileStreamXXX instead


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4797 in pharo: FS readStream writeStream problem

pharo

Comment #5 on issue 4797 by [hidden email]: FS readStream  
writeStream problem
http://code.google.com/p/pharo/issues/detail?id=4797

that has been fixed and the FileReference now return only existing streams


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4797 in pharo: FS readStream writeStream problem

pharo
Updates:
        Labels: Filesystem
        Blockedon: pharo:6132

Comment #6 on issue 4797 by [hidden email]: FS readStream  
writeStream problem
http://code.google.com/p/pharo/issues/detail?id=4797

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4797 in pharo: FS readStream writeStream problem

pharo
Updates:
        Blockedon: -pharo:6132

Comment #7 on issue 4797 by [hidden email]: FS readStream  
writeStream problem
http://code.google.com/p/pharo/issues/detail?id=4797

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker
Reply | Threaded
Open this post in threaded view
|

Re: Issue 4797 in pharo: FS readStream writeStream problem

pharo
Updates:
        Status: Duplicate
        Mergedinto: 5978

Comment #8 on issue 4797 by [hidden email]: FS readStream  
writeStream problem
http://code.google.com/p/pharo/issues/detail?id=4797

(No comment was entered for this change.)


_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-bugtracker