IdCompressZlib 구성 요소를 CBuilderXE, 과 함께 사용해야하지만 그 주제에 대한 설명서 나 예제를 찾지 못했습니다. 나는 실험을 통해 그것을 사용하려고 시도했다.CBuilderXE와 함께 IdCompressZlib 구성 요소를 사용하는 방법
누군가가 저의 구성 요소를 사용하는 방법이나 그러한 주제에 유용한 몇 가지 예를 게시 할 수 있습니까?
업데이트 : Belowe I가 errore을 제공 tryed하고있는 샘플 코드 -5 메소드 InflateStream가 호출 :
int err;
String Fun = "[TestCompress] ", s1, zipString, strTest = "The 'zlib' compression library provides in-memory compression \
and decompression functions, including integrity checks of the uncompressed data. \
This version of the library supports only one compression method (deflation) \
but other algorithms will be added later and will have the same stream interface. ";
TStringStream * inpStream = NULL, *outStream = NULL;
TMemoryStream * stream1 = NULL, *stream2 = NULL;
stream1 = new TMemoryStream();
stream2 = new TMemoryStream();
inpStream = new TStringStream();
outStream = new TStringStream();
inpStream->Clear();
inpStream->WriteString(strTest);
stream1->LoadFromStream(inpStream);
stream1->Position = 0;
IdCompressorZLib1->InflateStream(stream1, stream2);
outStream->Clear();
stream2->SaveToStream(outStream);
zipString = outStream->DataString;
MyLog(Fun + Format("Compress test: Compress size from [%d] to [%d]",
ARRAYOFCONST((strTest.Length(), zipString.Length()))));
무엇 정확하게에 문제가 있습니까? 지금까지 해보지 못한 것이 당신에게 효과가 없었던 것은 무엇입니까? 'TIdCompressorZLib'를 정확히 사용하려고합니까? –
안녕하세요, 제 첫 번째 문제는 구성 요소에 대한 문서가 부족하므로 예제에서 많은 도움을 얻을 수 있습니다. 스트림 내에서 문자열을 압축하기 위해 간단한 테스트를했습니다. – enzo2
마지막 시도는 다음과 같았으며 항상 InflateStream 메소드를 호출 할 때 ann 에러 Z_DATA_ERROR (-3)을가집니다. – enzo2