
Compression, decompression and coding library in base64.
Implemented in Delphi language, it uses the concept of fluent interface to guide the use of the library.
Library developed using native compression and decompression classes (ZLIB) and Delphi base64 coding.
Base64 : Base compression and coding class and base decoding and decoding and decompression.
Data : Data compression and decompression class.
Compression algorithm implemented:
DeflateGZipNote: Functions always return an MD5 before coding and MD5 after coding, which can be used to ensure that a particular text has been decoded correctly and validating with the MD5 generated before coding.
Compression and decompression framework with the base64 coding option.
Text compression:
Image compression
Bitmap
PNG, JPG
These file types have already suffered a compression process in their creation, the result of a new compression is not so significant.
In the demo app, there is an example of Format PNG image compression, totaling 42,436 bytes:
Compression algorithm: deflate
Using the BOSS (Dependency Manager for Delphi) it is possible to install the library automatically.
boss install github.com/antoniojmsjr/ZLibFramework
Project> Options> Delphi Compiler> Target> All Configations> Search Path
..ZLibFrameworkSource
uses ZLibFramework, ZLibFramework.Types; var
lResultCompress: IZLibResult;
lMsgError: string;
begin
try
lResultCompress := TZLib
.Base64
.Compress
.Deflate
.Level(TZLibCompressionLevelType.Max)
.Text( ' 1234567890 ' );
Application.MessageBox(PWideChar(lResultCompress.TextUTF8), ' C O M P R E S S Ã O ' , MB_OK + MB_ICONINFORMATION);
except
on E: EZLibException do
begin
lMsgError := Concat(lMsgError, Format( ' Mode: %s ' , [E.Mode.AsString]), sLineBreak);
lMsgError := Concat(lMsgError, Format( ' Operation: %s ' , [E.Operation.AsString]), sLineBreak);
lMsgError := Concat(lMsgError, Format( ' Algorithm: %s ' , [E.Algorithm.AsString]), sLineBreak);
lMsgError := Concat(lMsgError, Format( ' Encoding Fail: %s ' , [BoolToStr(E.EncodingFail, True)]), sLineBreak);
lMsgError := Concat(lMsgError, Format( ' Message: %d ' , [E.Message]), sLineBreak);
lMsgError := Concat(lMsgError, Format( ' Hint: %s ' , [E.Hint]));
Application.MessageBox(PWideChar(lMsgError), ' A T E N Ç Ã O ' , MB_OK + MB_ICONERROR);
end ;
on E: Exception do
begin
Application.MessageBox(PWideChar(E.Message), ' A T E N Ç Ã O ' , MB_OK + MB_ICONERROR);
end ;
end ;
end ;
ZLibFramework is free and open-source software licensed under the