I'm trying to save a jpeg file on my disc. I tried a lot of different classes but could not get something worki ng. So I came back with the simplest idea I got
| contents string stream | contents := 'http://www.bedetheque.com/Couvertures/ AntonBlake1_05042005.jpg' asUrl retrieveContents. string := (FileDirectory default fullName, FileDirectory default pathNameDelimiter asString, 'Couvertures', FileDirectory default pathNameDelimiter asString, 'Anton.jpg' ). stream := string asFileName writeStream. stream nextPutAll: contents content. stream close
I could not understand why this was not working....Nothing was put in the file.
Then after losing 30 min. I found the solution
| contents string stream | contents := 'http://www.bedetheque.com/Couvertures/ AntonBlake1_05042005.jpg' asUrl retrieveContents. string := (FileDirectory default fullName, FileDirectory default pathNameDelimiter asString, 'Anton.jpg' ). stream := FileStream newFileNamed: string. stream nextPutAll: ((RWBinaryOrTextStream with: contents content) binary) contents. stream close
squeak-dev@lists.squeakfoundation.org