@classmethod
    def read(cls, fd, str_cache, object_cache, traits_cache):
        header = AMF3Integer.read(fd)
        obj = None

        if (header & 1) == 0:
            index = header >> 1
            obj = object_cache[index]
        else:
            header >>= 1
            obj = AMF3Array()
            object_cache.append(obj)

            key = AMF3String.read(fd, cache=str_cache)
            while len(key) > 0:
                value = AMF3Value.read(fd, str_cache=str_cache,
                                       object_cache=object_cache,
                                       traits_cache=traits_cache)
                obj[key] = value
                key = AMF3String.read(fd, cache=str_cache)

            for i in range(header):
                value = AMF3Value.read(fd, str_cache=str_cache,
                                       object_cache=object_cache,
                                       traits_cache=traits_cache)
                obj[i] = value

        return obj
dataset/ETHPy150Open chrippa/livestreamer/src/livestreamer/packages/flashmedia/types.py/AMF3ArrayPacker.read/original