Upload 2.0.2
[physicsfs] / lzma / CS / 7zip / ICoder.cs
1 // ICoder.h
2
3 using System;
4
5 namespace 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 size of dictionary.
82                 /// </summary>
83                 DictionarySize = 0x400,
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 number of postion state bits for LZMA (0 <= x <= 4).
94                 /// </summary>
95                 PosStateBits = 0x440,
96                 /// <summary>
97                 /// Specifies number of literal context bits for LZMA (0 <= x <= 8).
98                 /// </summary>
99                 LitContextBits,
100                 /// <summary>
101                 /// Specifies number of literal position bits for LZMA (0 <= x <= 4).
102                 /// </summary>
103                 LitPosBits,
104                 /// <summary>
105                 /// Specifies number of fast bytes for LZ*.
106                 /// </summary>
107                 NumFastBytes = 0x450,
108                 /// <summary>
109                 /// Specifies match finder. LZMA: "BT2", "BT4" or "BT4B".
110                 /// </summary>
111                 MatchFinder,
112                 /// <summary>
113                 /// Specifies number of passes.
114                 /// </summary>
115                 NumPasses = 0x460,
116                 /// <summary>
117                 /// Specifies number of algorithm.
118                 /// </summary>
119                 Algorithm = 0x470,
120                 /// <summary>
121                 /// Specifies multithread mode.
122                 /// </summary>
123                 MultiThread = 0x480,
124                 /// <summary>
125                 /// Specifies mode with end marker.
126                 /// </summary>
127                 EndMarker = 0x490
128         };
129
130
131         public interface ISetCoderProperties
132         {
133                 void SetCoderProperties(CoderPropID[] propIDs, object[] properties);
134         };
135
136         public interface IWriteCoderProperties
137         {
138                 void WriteCoderProperties(System.IO.Stream outStream);
139         }
140
141         public interface ISetDecoderProperties
142         {
143                 void SetDecoderProperties(byte[] properties);
144         }
145 }