'fobj is a file-like object as an icns resource'

def __init__(self, fobj):

    self.dct = dct = {}
    self.fobj = fobj
    (sig, filesize) = nextheader(fobj)
    if (sig != 'icns'):
        raise SyntaxError('not    an    icns    file')
    i = HEADERSIZE
    while (i < filesize):
        (sig, blocksize) = nextheader(fobj)
        if (blocksize <= 0):
            raise SyntaxError('invalid    block    header')
        i += HEADERSIZE
        blocksize -= HEADERSIZE
        dct[sig] = (i, blocksize)
        fobj.seek(blocksize, 1)
        i += blocksize
