Files
sharpcompress/src/SharpCompress/Compressors/LZMA/ICoder.cs

167 lines
3.6 KiB
C#
Raw Normal View History

2015-12-30 11:19:42 +00:00
using System;
using System.IO;
2015-12-30 11:19:42 +00:00
2022-12-20 15:06:44 +00:00
namespace SharpCompress.Compressors.LZMA;
/// <summary>
/// The exception that is thrown when an error in input stream occurs during decoding.
/// </summary>
2025-10-14 10:20:04 +01:00
public class DataErrorException : Exception
2022-12-20 15:06:44 +00:00
{
2023-03-21 13:14:08 +00:00
public DataErrorException()
: base("Data Error") { }
2022-12-20 15:06:44 +00:00
}
/// <summary>
/// The exception that is thrown when the value of an argument is outside the allowable range.
/// </summary>
2025-10-14 10:20:04 +01:00
public class InvalidParamException : Exception
2022-12-20 15:06:44 +00:00
{
2023-03-21 13:14:08 +00:00
public InvalidParamException()
: base("Invalid Parameter") { }
2022-12-20 15:06:44 +00:00
}
public interface ICodeProgress
{
/// <summary>
/// Callback progress.
/// </summary>
/// <param name="inSize">
/// input size. -1 if unknown.
/// </param>
/// <param name="outSize">
/// output size. -1 if unknown.
/// </param>
void SetProgress(long inSize, long outSize);
}
internal interface ICoder
{
/// <summary>
/// Codes streams.
/// </summary>
/// <param name="inStream">
/// input Stream.
/// </param>
/// <param name="outStream">
/// output Stream.
/// </param>
/// <param name="inSize">
/// input Size. -1 if unknown.
/// </param>
/// <param name="outSize">
/// output Size. -1 if unknown.
/// </param>
/// <param name="progress">
/// callback progress reference.
/// </param>
2022-12-20 15:14:22 +00:00
void Code(Stream inStream, Stream outStream, long inSize, long outSize, ICodeProgress progress);
2022-12-20 15:06:44 +00:00
}
/*
public interface ICoder2
{
void Code(ISequentialInStream []inStreams,
const UInt64 []inSizes,
ISequentialOutStream []outStreams,
UInt64 []outSizes,
ICodeProgress progress);
};
*/
/// <summary>
/// Provides the fields that represent properties idenitifiers for compressing.
/// </summary>
internal enum CoderPropId
2015-12-30 11:19:42 +00:00
{
/// <summary>
2022-12-20 15:06:44 +00:00
/// Specifies default property.
/// </summary>
DefaultProp = 0,
/// <summary>
/// Specifies size of dictionary.
/// </summary>
DictionarySize,
/// <summary>
/// Specifies size of memory for PPM*.
/// </summary>
UsedMemorySize,
/// <summary>
/// Specifies order for PPM methods.
/// </summary>
Order,
/// <summary>
/// Specifies Block Size.
/// </summary>
BlockSize,
/// <summary>
/// Specifies number of postion state bits for LZMA (0 - x - 4).
/// </summary>
PosStateBits,
/// <summary>
/// Specifies number of literal context bits for LZMA (0 - x - 8).
/// </summary>
LitContextBits,
/// <summary>
/// Specifies number of literal position bits for LZMA (0 - x - 4).
/// </summary>
LitPosBits,
/// <summary>
/// Specifies number of fast bytes for LZ*.
/// </summary>
NumFastBytes,
/// <summary>
/// Specifies match finder. LZMA: "BT2", "BT4" or "BT4B".
/// </summary>
MatchFinder,
/// <summary>
/// Specifies the number of match finder cyckes.
/// </summary>
MatchFinderCycles,
/// <summary>
/// Specifies number of passes.
/// </summary>
NumPasses,
/// <summary>
/// Specifies number of algorithm.
/// </summary>
Algorithm,
/// <summary>
/// Specifies the number of threads.
/// </summary>
NumThreads,
/// <summary>
/// Specifies mode with end marker.
/// </summary>
2025-01-14 09:07:40 +00:00
EndMarker,
2022-12-20 15:06:44 +00:00
}
internal interface ISetCoderProperties
{
void SetCoderProperties(ReadOnlySpan<CoderPropId> propIDs, ReadOnlySpan<object> properties);
2022-12-20 15:06:44 +00:00
}
internal interface IWriteCoderProperties
{
void WriteCoderProperties(Stream outStream);
}
internal interface ISetDecoderProperties
{
void SetDecoderProperties(byte[] properties);
2022-07-29 14:06:53 -04:00
}