def __init__(self, parent, name, nbytes, description="Padding", pattern=None): """ pattern is None or repeated string """ assert (pattern is None) or (isinstance(pattern, bytes)) Bytes.__init__(self, parent, name, nbytes, description) self.pattern = pattern self._display_pattern = self.checkPattern()
def __init__(self, parent, name, length, decompressor, description=None, parser=None, filename=None, mime_type=None, parser_class=None): if filename: if not isinstance(filename, str): filename = makePrintable(filename, "ISO-8859-1") if not description: description = 'File "%s" (%s)' % ( filename, humanFilesize(length)) Bytes.__init__(self, parent, name, length, description) self.setupInputStream(decompressor, parser, filename, mime_type, parser_class)
def __init__(self, parent, name, description=None, strip=None, nbytes=None, truncate=None): Bytes.__init__(self, parent, name, 1, description) self._format = "WidePascalString16" self._strip = strip self._truncate = truncate self._character_size = 2 self._charset = "UTF-16-LE" self._content_offset = 2 self._content_size = self._character_size * self._parent.stream.readBits( self.absolute_address, self._content_offset * 8, self._parent.endian) self._size = (self._content_size + self.content_offset) * 8
def __init__(self, parent, name, length, description=None, parser=None, filename=None, mime_type=None, parser_class=None): if filename: if not isinstance(filename, str): filename = makePrintable(filename, "ISO-8859-1") if not description: description = 'File "%s" (%s)' % ( filename, humanFilesize(length)) Bytes.__init__(self, parent, name, length, description) def createInputStream(cis, **args): tags = args.setdefault("tags", []) if parser_class: tags.append(("class", parser_class)) if parser is not None: tags.append(("id", parser.PARSER_TAGS["id"])) if mime_type: tags.append(("mime", mime_type)) if filename: tags.append(("filename", filename)) return cis(**args) self.setSubIStream(createInputStream)
def __init__(self, parent): Bytes.__init__(self, parent, 'file', parent['size'].value, None)
def __init__(self, parent, name, *args, **kwargs): Bytes.__init__(self, parent, name, 16, *args, **kwargs)