/* ICompressCoder::Code ICompressCoder2::Code returns: S_OK : OK S_FALSE : data error (for decoders) E_OUTOFMEMORY : memory allocation error E_NOTIMPL : unsupported encoding method (for decoders) another error code : some error. For example, it can be error code received from inStream or outStream function. Parameters: (inStream != NULL) (outStream != NULL)
if (inSize != NULL) { Encoders in 7-Zip ignore (inSize). Decoder can use (*inSize) to check that stream was decoded correctly. Some decoder in 7-Zip check it, if (full_decoding mode was set via ICompressSetFinishMode) }
If it's required to limit the reading from input stream (inStream), it can be done with ISequentialInStream implementation.
if (outSize != NULL) { Encoders in 7-Zip ignore (outSize). Decoder unpacks no more than (*outSize) bytes. } (progress == NULL) is allowed.
Decoding with Code() function ----------------------------- You can request some interfaces before decoding - ICompressSetDecoderProperties2 - ICompressSetFinishMode
If you need to decode full stream: { 1) try to set full_decoding mode with ICompressSetFinishMode::SetFinishMode(1); 2) call the Code() function with specified (inSize) and (outSize), if these sizes are known. }
If you need to decode only part of stream: { 1) try to set partial_decoding mode with ICompressSetFinishMode::SetFinishMode(0); 2) Call the Code() function with specified (inSize = NULL) and specified (outSize). }
Encoding with Code() function ----------------------------- You can request some interfaces : - ICompressSetCoderProperties - use it before encoding to set properties - ICompressWriteCoderProperties - use it before or after encoding to request encoded properties.
ICompressCoder2 is used when (numInStreams != 1 || numOutStreams != 1) The rules are similar to ICompressCoder rules
*/
namespace NCoderPropID
{ enum EEnum
{
kDefaultProp = 0,
kDictionarySize, // VT_UI4
kUsedMemorySize, // VT_UI4
kOrder, // VT_UI4
kBlockSize, // VT_UI4 or VT_UI8
kPosStateBits, // VT_UI4
kLitContextBits, // VT_UI4
kLitPosBits, // VT_UI4
kNumFastBytes, // VT_UI4
kMatchFinder, // VT_BSTR
kMatchFinderCycles, // VT_UI4
kNumPasses, // VT_UI4
kAlgorithm, // VT_UI4
kNumThreads, // VT_UI4
kEndMarker, // VT_BOOL
kLevel, // VT_UI4
kReduceSize, // VT_UI8 : it's estimated size of largest data stream that will be compressed // encoder can use this value to reduce dictionary size and allocate data buffers
kExpectedDataSize, // VT_UI8 : for ICompressSetCoderPropertiesOpt : // it's estimated size of current data stream // real data size can differ from that size // encoder can use this value to optimize encoder initialization
kBlockSize2, // VT_UI4 or VT_UI8
kCheckSize, // VT_UI4 : size of digest in bytes
kFilter, // VT_BSTR
kMemUse // VT_UI8
};
}
/* finishMode: 0 : partial decoding is allowed. It's default mode for ICompressCoder::Code(), if (outSize) is defined.
1 : full decoding. The stream must be finished at the end of decoding. */
};
/* returns: S_OK : (*value) contains the size or estimated size (can be incorrect size) S_FALSE : size is undefined E_NOTIMP : the feature is not implemented
Let's (read_size) is size of data that was already read by ISequentialInStream::Read(). The caller should call GetSubStreamSize() after each Read() and check sizes: if (start_of_subStream + *value < read_size) { // (*value) is correct, and it's allowed to call GetSubStreamSize() for next subStream: start_of_subStream += *value; subStream++; }
*/
};
/* That function initializes decoder structures. Call this function only for stream version of decoder. if (outSize == NULL), then output size is unknown
if (outSize != NULL), then the decoder must stop decoding after (*outSize) bytes. */
};
/* ICompressFilter Filter() converts as most as possible bytes returns: (outSize): if (outSize <= size) : Filter have converted outSize bytes if (outSize > size) : Filter have not converted anything. and it needs at least outSize bytes to convert one block (it's for crypto block algorithms).
*/
/* Call ResetInitVector() only for encoding. Call ResetInitVector() before encoding and before WriteCoderProperties().
Crypto encoder can create random IV in that function. */
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.