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
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
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
Returns
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)