Repetier-Host Plugin
2.0.0
|
C# stores strings as arrach of 16 bit chars. Especially with gcode which uses only 7 bit ascii it is a waste of ram if storing many lines. This class converts standard strings to byte arrays and back for a better memory print. More...
Public Member Functions | |
CompressedString (string text) | |
CompressedString (byte[] text) | |
override string | ToString () |
Static Public Member Functions | |
static byte [] | Compress (string text) |
static string | Uncompress (byte[] data) |
Static Public Attributes | |
static System.Text.UTF8Encoding | enc = new UTF8Encoding() |
C# stores strings as arrach of 16 bit chars. Especially with gcode which uses only 7 bit ascii it is a waste of ram if storing many lines. This class converts standard strings to byte arrays and back for a better memory print.
You can use either the class itself which has the overhead of an additional reference to byte array or use the static function directly to switch between byte array and string.