> Hi Stef,
> 
> because this method can be called from Form class >> #fromFileNamed:
> and can work in case you use native binary Form representation.

I would move fromFileNamed: too 

Stef

> Any idea how to solve it in more cleaner way?
> 
> Cheers,
> -- Pavel
> 
> 
> 
> On Wed, Nov 21, 2012 at 2:50 PM, Stéphane Ducasse
> <[email protected]> wrote:
>> Pavel
>> 
>> why not moving this class on the ImageWriter package
>> because
>>        - I do not like this Smalltalk globals at: ifPresent:
>>        especially when there is no default.
>> 
>>        - This method does not make sense without the ImageReadWriter
>> 
>> 
>> Form classSide>>fromBinaryStream: (in category 'instance creation') 
>> -----fromBinaryStream: aBinaryStream
>>        "Read a Form or ColorForm from given file, using the first byte of 
>> the file to guess its format. Currently handles: GIF, uncompressed BMP, and 
>> both old and new DisplayObject writeOn: formats, JPEG, and PCX. Return nil 
>> if the file could not be read or was of an unrecognized format."
>> 
>>        | firstByte |
>>        aBinaryStream binary.
>>        firstByte := aBinaryStream next.
>>        firstByte = 1 ifTrue: [
>>                "old Squeakform format"
>>                ^ self new readFromOldFormat: aBinaryStream].
>>        firstByte = 2 ifTrue: [
>>                "new Squeak form format"
>>                ^ self new readFrom: aBinaryStream].
>> 
>>        "Try for JPG, GIF, or PCX..."
>>        "Note: The following call closes the stream."
>> +       Smalltalk globals at: #ImageReadWriter ifPresent: [:imageReadWriter |
>> +               ^ imageReadWriter formFromStream: aBinaryStream]
> 


Reply via email to