StreamPeerGZIP
Experimental: This class may be changed or removed in future versions.
Hereda: StreamPeer < RefCounted < Object
A stream peer that handles GZIP and deflate compression/decompression.
Descripción
This class allows to compress or decompress data using GZIP/deflate in a streaming fashion. This is particularly useful when compressing or decompressing files that have to be sent through the network without needing to allocate them all in memory.
After starting the stream via start_compression() (or start_decompression()), calling StreamPeer.put_partial_data() on this stream will compress (or decompress) the data, writing it to the internal buffer. Calling StreamPeer.get_available_bytes() will return the pending bytes in the internal buffer, and StreamPeer.get_partial_data() will retrieve the compressed (or decompressed) bytes from it. When the stream is over, you must call finish() to ensure the internal buffer is properly flushed (make sure to call StreamPeer.get_available_bytes() on last time to check if more data needs to be read after that).
Métodos
void |
clear() |
finish() |
|
start_compression(use_deflate: bool = false, buffer_size: int = 65535) |
|
start_decompression(use_deflate: bool = false, buffer_size: int = 65535) |
Descripciones de Métodos
void clear() 🔗
Limpia este flujo, reiniciando el estado interno.
Finaliza el flujo, comprimiendo cualquier fragmento almacenado en búfer que quede.
Debes llamarlo solo cuando estés comprimiendo.
Error start_compression(use_deflate: bool = false, buffer_size: int = 65535) 🔗
Inicia el flujo en modo de compresión con el buffer_size dado, si use_deflate es true usa deflate en lugar de GZIP.
Error start_decompression(use_deflate: bool = false, buffer_size: int = 65535) 🔗
Inicia el flujo en modo de descompresión con el buffer_size dado, si use_deflate es true usa deflate en lugar de GZIP.