1
0
mirror of https://github.com/chylex/Brotli-Builder.git synced 2024-12-22 16:42:46 +01:00
Brotli-Builder/BrotliImpl/Encoders/EncodeUncompressedOnly.cs

19 lines
639 B
C#

using BrotliLib.Brotli.Components;
using BrotliLib.Brotli.Components.Header;
using BrotliLib.Brotli.Encode;
using BrotliLib.Collections;
namespace BrotliImpl.Encoders{
/// <summary>
/// Encodes bytes into a series of uncompressed meta-blocks.
/// </summary>
public class EncodeUncompressedOnly : IBrotliEncoder{
public (MetaBlock, BrotliEncodeInfo) Encode(BrotliEncodeInfo info){
var bytes = CollectionHelper.SliceAtMost(info.Bytes, DataLength.MaxUncompressedBytes);
var mb = new MetaBlock.Uncompressed(bytes);
return (mb, info.WithOutputtedMetaBock(mb));
}
}
}