ICoder.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. using System;
  2. using System.IO;
  3. namespace SharpCompress.Compressors.LZMA
  4. {
  5. /// <summary>
  6. /// The exception that is thrown when an error in input stream occurs during decoding.
  7. /// </summary>
  8. internal class DataErrorException : Exception
  9. {
  10. public DataErrorException()
  11. : base("Data Error")
  12. {
  13. }
  14. }
  15. /// <summary>
  16. /// The exception that is thrown when the value of an argument is outside the allowable range.
  17. /// </summary>
  18. internal class InvalidParamException : Exception
  19. {
  20. public InvalidParamException()
  21. : base("Invalid Parameter")
  22. {
  23. }
  24. }
  25. internal interface ICodeProgress
  26. {
  27. /// <summary>
  28. /// Callback progress.
  29. /// </summary>
  30. /// <param name="inSize">
  31. /// input size. -1 if unknown.
  32. /// </param>
  33. /// <param name="outSize">
  34. /// output size. -1 if unknown.
  35. /// </param>
  36. void SetProgress(Int64 inSize, Int64 outSize);
  37. }
  38. internal interface ICoder
  39. {
  40. /// <summary>
  41. /// Codes streams.
  42. /// </summary>
  43. /// <param name="inStream">
  44. /// input Stream.
  45. /// </param>
  46. /// <param name="outStream">
  47. /// output Stream.
  48. /// </param>
  49. /// <param name="inSize">
  50. /// input Size. -1 if unknown.
  51. /// </param>
  52. /// <param name="outSize">
  53. /// output Size. -1 if unknown.
  54. /// </param>
  55. /// <param name="progress">
  56. /// callback progress reference.
  57. /// </param>
  58. void Code(Stream inStream, Stream outStream,
  59. Int64 inSize, Int64 outSize, ICodeProgress progress);
  60. }
  61. /*
  62. public interface ICoder2
  63. {
  64. void Code(ISequentialInStream []inStreams,
  65. const UInt64 []inSizes,
  66. ISequentialOutStream []outStreams,
  67. UInt64 []outSizes,
  68. ICodeProgress progress);
  69. };
  70. */
  71. /// <summary>
  72. /// Provides the fields that represent properties idenitifiers for compressing.
  73. /// </summary>
  74. internal enum CoderPropId
  75. {
  76. /// <summary>
  77. /// Specifies default property.
  78. /// </summary>
  79. DefaultProp = 0,
  80. /// <summary>
  81. /// Specifies size of dictionary.
  82. /// </summary>
  83. DictionarySize,
  84. /// <summary>
  85. /// Specifies size of memory for PPM*.
  86. /// </summary>
  87. UsedMemorySize,
  88. /// <summary>
  89. /// Specifies order for PPM methods.
  90. /// </summary>
  91. Order,
  92. /// <summary>
  93. /// Specifies Block Size.
  94. /// </summary>
  95. BlockSize,
  96. /// <summary>
  97. /// Specifies number of postion state bits for LZMA (0 - x - 4).
  98. /// </summary>
  99. PosStateBits,
  100. /// <summary>
  101. /// Specifies number of literal context bits for LZMA (0 - x - 8).
  102. /// </summary>
  103. LitContextBits,
  104. /// <summary>
  105. /// Specifies number of literal position bits for LZMA (0 - x - 4).
  106. /// </summary>
  107. LitPosBits,
  108. /// <summary>
  109. /// Specifies number of fast bytes for LZ*.
  110. /// </summary>
  111. NumFastBytes,
  112. /// <summary>
  113. /// Specifies match finder. LZMA: "BT2", "BT4" or "BT4B".
  114. /// </summary>
  115. MatchFinder,
  116. /// <summary>
  117. /// Specifies the number of match finder cyckes.
  118. /// </summary>
  119. MatchFinderCycles,
  120. /// <summary>
  121. /// Specifies number of passes.
  122. /// </summary>
  123. NumPasses,
  124. /// <summary>
  125. /// Specifies number of algorithm.
  126. /// </summary>
  127. Algorithm,
  128. /// <summary>
  129. /// Specifies the number of threads.
  130. /// </summary>
  131. NumThreads,
  132. /// <summary>
  133. /// Specifies mode with end marker.
  134. /// </summary>
  135. EndMarker
  136. }
  137. internal interface ISetCoderProperties
  138. {
  139. void SetCoderProperties(CoderPropId[] propIDs, object[] properties);
  140. }
  141. internal interface IWriteCoderProperties
  142. {
  143. void WriteCoderProperties(Stream outStream);
  144. }
  145. internal interface ISetDecoderProperties
  146. {
  147. void SetDecoderProperties(byte[] properties);
  148. }
  149. }