#REFACTORING by stefan
class: MacOSXIconReader
changed: #readSingleIcon:from:
refactor return with exception handler
--- a/MacOSXIconReader.st Wed Feb 08 00:57:34 2017 +0100
+++ b/MacOSXIconReader.st Wed Feb 08 19:44:06 2017 +0100
@@ -169,12 +169,11 @@
readSingleIcon:iconType from:iconBytes
"read a single image from the inputStream."
- |img|
-
- Error handle:[:ex |
+ ^ Error handle:[:ex |
self fileFormatError:'internal error / unhandled icon format: ',iconType.
+ nil
] do:[
- img := self
+ self
perform:('read_',(iconType copyReplaceAny:#( $# $ ) with:$_),'_from:') asSymbol
with:iconBytes
ifNotUnderstood:[
@@ -184,12 +183,13 @@
nil
].
].
- ^ img.
"
self fromFile:'/Applications/TextEdit.app/Contents/Resources/txt.icns'
self fromFile:'test.icns'
"
+
+ "Modified: / 08-02-2017 / 19:08:05 / stefan"
! !
!MacOSXIconReader methodsFor:'image writing'!