question: private Resource packIcon ( int dpi , Bitmap icon ) { Resource res = new Resource ( ) ; res . dpi = dpi ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; if ( icon . compress ( IMAGE_FORMAT , IMAGE_COMPRESSION_QUALITY , os ) ) { res . data = os . toByteArray ( ) ; } return res ; }
target:  Serialize an icon Resource for persistence, including a checksum wrapper. 