ICoder.cs 3.3 KB

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