4.19.2 Chunk class

A Chunk object is passed to the callback methods of the MBReader class. It contains information about the current chunk and it can be used to read the actual chunk data. A Chunk object has the following attributes and methods:

tag
This is a string containing four characters that represent the chunk name.

size
The size in bytes of the data part of the chunk.

pos
The absolute position of the data part within the input file.

depth
The depth of the chunk (i.e. how deep it is nested). The root has a depth of 0.

parent
The GroupChunk object of the parent chunk. In the case of the root group chunk this attribute is None.

chunkPath( )
Return a string containing the full path to this chunk. The result is a concatenation of all chunk names that lead to this chunk.

read( bytes=-1)
Read the specified number of bytes from the chunk. If bytes is -1 the entire chunk data is read. The return value is a string containing the binary data.