@classmethod
def from_fileobj(cls, fileobj, check=True):
    """Read the struct from a file object."""
    if fileobj.name.endswith('.mat'):
        return cls.from_binary(fileobj)
    return cls.from_string(fileobj.read())
