Skip to content

RunlengthEncoder

BinaryRunlengthEncoder(trim=Trim.trailing)

Bases: _RunlengthEncoder

Runlength encoder for binary data.

PARAMETER DESCRIPTION
trim

Specifies whether leading and/or trailing skips should be omitted.

TYPE: Trim DEFAULT: trailing

add(byte)

Add a byte to the encoder.

PARAMETER DESCRIPTION
byte

Byte to add.

TYPE: int

add_bytes(data)

Add multiple bytes to the encoder.

PARAMETER DESCRIPTION
data

Bytes to add.

TYPE: bytes

end()

Finish encoding and return the compressed data.

RETURNS DESCRIPTION
bytes

Compressed data as bytes.

skip(amount)

Skip the specified number of elements.

PARAMETER DESCRIPTION
amount

Number of elements to skip.

TYPE: int

SymbolRunlengthEncoder(trim=Trim.trailing)

Bases: _RunlengthEncoder

Runlength encoder for symbolic data.

PARAMETER DESCRIPTION
trim

Specifies whether leading and/or trailing skips should be omitted.

TYPE: Trim DEFAULT: trailing

add(symbol)

Add a symbol to the encoder.

PARAMETER DESCRIPTION
symbol

Symbol to add.

TYPE: Any

add_list(symbols)

Add multiple symbols to the encoder.

PARAMETER DESCRIPTION
symbols

Symbols to add.

TYPE: Iterable

end()

Finish encoding and return the compressed data.

RETURNS DESCRIPTION
list

Compressed data as a list.

skip(amount)

Skip the specified number of elements.

PARAMETER DESCRIPTION
amount

Number of elements to skip.

TYPE: int

Trim

Bases: Enum

Specifies whether leading and/or trailing skips should be omitted.

both class-attribute instance-attribute

Omit both leading and trailing skips.

leading class-attribute instance-attribute

Omit leading skips.

none class-attribute instance-attribute

Do not omit skips.

trailing class-attribute instance-attribute

Omit trailing skips.