Paper Office
paper-docxAPI referenceimage.helpers

StreamReader

paper-docx 0.2.0 API reference

Wraps a file-like object to provide access to structured data from a binary file.

Byte-order is configurable. base_offset is added to any base value provided to calculate actual location for reads.

StreamReader(stream, byte_order, base_offset=0)

Functions

read

funcread(count)

Allow pass-through read() call.

paramcount

read_byte

funcread_byte(base, offset=0)

Return the int value of the byte at the file position defined by self._base_offset + base + offset.

If base is None, the byte is read from the current position in the stream.

parambase
paramoffset
= 0

read_long

funcread_long(base, offset=0)

Return the int value of the four bytes at the file position defined by self._base_offset + base + offset.

If base is None, the long is read from the current position in the stream. The endian setting of this instance is used to interpret the byte layout of the long.

parambase
paramoffset
= 0

read_short

funcread_short(base, offset=0)

Return the int value of the two bytes at the file position determined by base and offset, similarly to read_long() above.

parambase
paramoffset
= 0

read_str

funcread_str(char_count, base, offset=0)

Return a string containing the char_count bytes at the file position determined by self._base_offset + base + offset.

paramchar_count
parambase
paramoffset
= 0

seek

funcseek(base, offset=0)
parambase
paramoffset
= 0

tell

functell()

Allow pass-through tell() call.

On this page