mirror of
https://github.com/chylex/Brotli-Builder.git
synced 2024-12-22 16:42:46 +01:00
20 lines
744 B
C#
20 lines
744 B
C#
using BrotliLib.Brotli;
|
|
using BrotliLib.Brotli.Components;
|
|
using BrotliLib.Brotli.Encode;
|
|
using BrotliLib.Brotli.Output;
|
|
using BrotliLib.Brotli.Parameters;
|
|
|
|
namespace BrotliImpl.Transformers{
|
|
public class TransformCompressedIntoUncompressed : BrotliTransformerCompressed{
|
|
protected override (MetaBlock, BrotliGlobalState) Transform(MetaBlock.Compressed original, BrotliGlobalState state, BrotliCompressionParameters parameters){
|
|
var uncompressed = new BrotliOutputStored();
|
|
|
|
state.AddOutputCallback(uncompressed);
|
|
original.Decompress(state);
|
|
state.RemoveOutputCallback(uncompressed);
|
|
|
|
return (new MetaBlock.Uncompressed(uncompressed.AsBytes), state);
|
|
}
|
|
}
|
|
}
|