[Pharo-users] Lost in stream

Hilaire hilaire at drgeo.eu
Fri Jun 15 12:31:52 EDT 2018


Hi,

I have issue when moving away from the deprecated File API to save PNG 
image:

This fromer code to save file (xml or PNG file):

"    |streamOnDisk|
     [streamOnDisk := MultiByteFileStream forceNewFileNamed: (self 
absolutePath: filename).
     streamOnDisk nextPutAll: stream contents] ensure:
         [streamOnDisk close]"

and the newer one:

     (location  asFileReference / filename) binaryWriteStreamDo: [ 
:fileStream |
         fileStream nextPutAll: stream contents]

The new one produce both wrong XML file and PNG file. The file looks 
short cuted at the end.

The XML document contents itself a chunk of binary data (a bitmap 
dropped in the drgeo sketch), and the fragility seems to come from there.

I already met fragilities with some file when loading older drgeo 
document, but I have not fully tracked the issue.

What is wrong?

The enclosed archive contains both files saved with the former and newer 
methods, both XML and PNG documents.

Thanks

Hilaire

-- 
Dr. Geo
http://drgeo.eu

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OutputComparing.zip
Type: application/zip
Size: 352669 bytes
Desc: not available
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20180615/6a1df155/attachment-0001.zip>


More information about the Pharo-users mailing list