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