mirror of
https://github.com/chylex/Brotli-Builder.git
synced 2024-12-22 07:42:47 +01:00
46 lines
1.8 KiB
C#
46 lines
1.8 KiB
C#
using System;
|
|
using BrotliLib.Collections.Huffman;
|
|
|
|
namespace BrotliLib.Serialization.Writer{
|
|
/// <summary>
|
|
/// Provides a way to append complex values into a <see cref="BitStream"/> for convenience.
|
|
/// </summary>
|
|
public interface IBitWriter{
|
|
/// <summary>
|
|
/// Writes a single bit into the stream.
|
|
/// </summary>
|
|
/// <param name="bit">Input bit.</param>
|
|
void WriteBit(bool bit);
|
|
|
|
/// <summary>
|
|
/// Writes all bits from the provided bit stream.
|
|
/// </summary>
|
|
/// <param name="bits">Input bit stream.</param>
|
|
void WriteBits(BitStream bits);
|
|
|
|
/// <summary>
|
|
/// Writes all bits from the provided bit path.
|
|
/// </summary>
|
|
/// <param name="bits">Input bit path.</param>
|
|
void WriteBits(in BitPath bits);
|
|
|
|
/// <summary>
|
|
/// Writes a sequence of the specified amount of bits, using the least significant bits from the provided value.
|
|
/// </summary>
|
|
/// <param name="count">Amount of bits to write.</param>
|
|
/// <param name="value">Integer source of the bits.</param>
|
|
/// <exception cref="ArgumentOutOfRangeException">Thrown when the <paramref name="count"/> parameter is larger than the amount of bits in an integer.</exception>
|
|
void WriteChunk(int count, int value);
|
|
|
|
/// <summary>
|
|
/// If the current position is not already at a byte boundary (stream length divisible by 8), zeroes will be written to pad the rest of the byte.
|
|
/// </summary>
|
|
void AlignToByteBoundary();
|
|
|
|
/// <summary>
|
|
/// First aligns the position to a byte boundary, then writes all bytes into the aligned stream.
|
|
/// </summary>
|
|
void WriteAlignedBytes(byte[] bytes);
|
|
}
|
|
}
|