Table of Contents

Class StreamPeerGZip

Namespace
Godot
Assembly
GodotSharp.dll

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 StartCompression(bool, int) (or StartDecompression(bool, int)), calling PutPartialData(byte[]) on this stream will compress (or decompress) the data, writing it to the internal buffer. Calling GetAvailableBytes() will return the pending bytes in the internal buffer, and GetPartialData(int) 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 GetAvailableBytes() on last time to check if more data needs to be read after that).

[GodotClassName("StreamPeerGZIP")]
public class StreamPeerGZip : StreamPeer, IDisposable
Inheritance
StreamPeerGZip
Implements
Inherited Members

Constructors

StreamPeerGZip()

public StreamPeerGZip()

Methods

Clear()

Clears this stream, resetting the internal state.

public void Clear()

Finish()

Finalizes the stream, compressing or decompressing any buffered chunk left.

public Error Finish()

Returns

Error

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

StartCompression(bool, int)

Start the stream in compression mode with the given bufferSize, if useDeflate is true uses deflate instead of GZIP.

public Error StartCompression(bool useDeflate = false, int bufferSize = 65535)

Parameters

useDeflate bool
bufferSize int

Returns

Error

StartDecompression(bool, int)

Start the stream in decompression mode with the given bufferSize, if useDeflate is true uses deflate instead of GZIP.

public Error StartDecompression(bool useDeflate = false, int bufferSize = 65535)

Parameters

useDeflate bool
bufferSize int

Returns

Error