'Compressed messages should pass in bytes_to_read (via message size)
otherwise, we decode from data as Int32'

@classmethod
def decode(cls, data, bytes_to_read=None):

    if isinstance(data, bytes):
        data = io.BytesIO(data)
    if (bytes_to_read is None):
        bytes_to_read = Int32.decode(data)
    raw = io.BytesIO(data.read(bytes_to_read))
    items = []
    while bytes_to_read:
        try:
            offset = Int64.decode(raw)
            msg_bytes = Bytes.decode(raw)
            bytes_to_read -= ((8 + 4) + len(msg_bytes))
            items.append((offset, len(msg_bytes), Message.decode(msg_bytes)))
        except ValueError:
            items.append((None, None, PartialMessage()))
            break
    return items
