Skip to content
0.2.0-dev Download ZIP
43 lines ·2.5 KB Raw
1<?xml version="1.0" encoding="UTF-8" ?>
2<class name="StreamPeerGZIP" inherits="StreamPeer" api_type="core" experimental="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A stream peer that handles GZIP and deflate compression/decompression.
5 </brief_description>
6 <description>
7 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.
8 After starting the stream via [method start_compression] (or [method start_decompression]), calling [method StreamPeer.put_partial_data] on this stream will compress (or decompress) the data, writing it to the internal buffer. Calling [method StreamPeer.get_available_bytes] will return the pending bytes in the internal buffer, and [method StreamPeer.get_partial_data] will retrieve the compressed (or decompressed) bytes from it. When the stream is over, you must call [method finish] to ensure the internal buffer is properly flushed (make sure to call [method StreamPeer.get_available_bytes] on last time to check if more data needs to be read after that).
9 </description>
10 <tutorials>
11 </tutorials>
12 <methods>
13 <method name="clear">
14 <return type="void" />
15 <description>
16 Clears this stream, resetting the internal state.
17 </description>
18 </method>
19 <method name="finish">
20 <return type="int" enum="Error" />
21 <description>
22 Finalizes the stream, compressing any buffered chunk left.
23 You must call it only when you are compressing.
24 </description>
25 </method>
26 <method name="start_compression">
27 <return type="int" enum="Error" />
28 <param index="0" name="use_deflate" type="bool" default="false" />
29 <param index="1" name="buffer_size" type="int" default="65535" />
30 <description>
31 Start the stream in compression mode with the given [param buffer_size], if [param use_deflate] is [code]true[/code] uses deflate instead of GZIP.
32 </description>
33 </method>
34 <method name="start_decompression">
35 <return type="int" enum="Error" />
36 <param index="0" name="use_deflate" type="bool" default="false" />
37 <param index="1" name="buffer_size" type="int" default="65535" />
38 <description>
39 Start the stream in decompression mode with the given [param buffer_size], if [param use_deflate] is [code]true[/code] uses deflate instead of GZIP.
40 </description>
41 </method>
42 </methods>
43</class>