@classmethod<EOL><INDENT>def load(cls, stream, contentType=None, version=None):<DEDENT>
if contentType is None:<EOL><INDENT>contentType = constants.TYPE_OMADS_FILE<EOL><DEDENT>if ctype.getBaseType(contentType) == constants.TYPE_OMADS_FOLDER:<EOL><INDENT>from .folder import FolderItem<EOL>return FolderItem.load(stream, contentType, version)<EOL><DEDENT>if ctype.getBaseType(contentType) != constants.TYPE_OMADS_FILE:<EOL><INDENT>raise common.InvalidContentType('<STR_LIT>' % (contentType,))<EOL><DEDENT>if version is None:<EOL><INDENT>version = '<STR_LIT>'<EOL><DEDENT>if version != '<STR_LIT>':<EOL><INDENT>raise common.InvalidContentType('<STR_LIT>' % (version,))<EOL><DEDENT>ret = FileItem()<EOL>data = stream.read()<EOL>xdoc = ET.fromstring(data)<EOL>if xdoc.tag != '<STR_LIT>':<EOL><INDENT>raise common.InvalidContent('<STR_LIT>'<EOL>% (xdoc.tag,))<EOL><DEDENT>ret.name = xdoc.findtext('<STR_LIT:name>')<EOL>ret.body = xdoc.findtext('<STR_LIT:body>')<EOL>ret.size = xdoc.findtext('<STR_LIT:size>')<EOL>if ret.body is not None:<EOL><INDENT>ret.size = len(ret.body)<EOL><DEDENT>elif ret.size is not None:<EOL><INDENT>ret.size = int(ret.size)<EOL><DEDENT>for attr in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>val = xdoc.findtext(attr)<EOL>if val is not None:<EOL><INDENT>setattr(ret, attr, int(common.parse_ts_iso(val)))<EOL><DEDENT><DEDENT>for attr in ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>',<EOL>'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>val = xdoc.findtext('<STR_LIT>' + attr[<NUM_LIT:0>])<EOL>if val is not None:<EOL><INDENT>setattr(ret, attr, val.lower() == '<STR_LIT:true>')<EOL><DEDENT><DEDENT>return ret<EOL>
Reverses the effects of the :meth:`dump` method, creating a FileItem
from the specified file-like `stream` object.