Difference between revisions of "paszlib/ko"

From Lazarus wiki
Jump to navigationJump to search
m (Fixed syntax highlighting; removed categories included in template)
 
(10 intermediate revisions by 2 users not shown)
Line 8: Line 8:
  
 
==TZipper==
 
==TZipper==
TZipper implements support for compressing and decompressing .zip files, but does not support all zip compression methods.
+
TZipper은 압축 .zip 파일을 압축 해제에 대한 지원을 하지만 모든 압축 방식을 지원하지 않습니다.
  
 
===문서===
 
===문서===
Line 15: Line 15:
 
===예제===
 
===예제===
  
====Zip files====
+
====Zip 파일 생성====
  
Create a zip file named as parameter 1. Treats all other parameters as filenames to add, so you can specify e.g.  
+
첫번째 인수에 파일이름을 입력하여 zip 파일을 생성할 수 있습니다. 이후 인자 파일이름을 추가하여 zip파일에 포함합니다.
  
<syntaxhighlight language="dos">zipper newzip.zip autoexec.bat config.sys</syntaxhighlight>
+
다음은 생성하는 예입니다.
  
<syntaxhighlight>
+
<syntaxhighlight lang="dos">zipper newzip.zip autoexec.bat config.sys</syntaxhighlight>
 +
 
 +
<syntaxhighlight lang=pascal>
 
uses
 
uses
 
   Zipper;
 
   Zipper;
Line 40: Line 42:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
====Unzip files====
+
====Zip 압축 풀기====
  
Unzip all files in archive c:\test.zip into directory c:\windows\temp\
+
c:\test.zip 압축파일의 모든 파일을 c:\windows\temp\ 디렉토리에 풀기
  
<syntaxhighlight>uses
+
<syntaxhighlight lang=pascal>uses
 
   Zipper;
 
   Zipper;
 
var
 
var
Line 64: Line 66:
 
* the test program: [http://svn.freepascal.org/svn/fpc/trunk/packages/paszlib/tests]
 
* the test program: [http://svn.freepascal.org/svn/fpc/trunk/packages/paszlib/tests]
  
====Unzip file to a stream====
+
====스트림 파일 압축 풀기====
In Lazarus, drop a TMemo, TButton, TEdit and TFileNameEdit on a form. Clicking the button will read the zip file in FileNameEdit, extract the file specified in the Edit box, and display the content in Memo.
+
라자루스 폼위에 TMemo, TButton, TEdit, TFileNameEdit 를 올립니다.
 +
 
 +
버튼을 클릭하면 FileNameEdit에서 zip 파일을 읽어, Edit박스에 입력된 파일을 압축해제 합니다.
 +
 
 +
그리고 압축 내용을 Memo에 출력합니다.
  
<syntaxhighlight>uses
+
<syntaxhighlight lang=pascal>uses
 
   Zipper;
 
   Zipper;
  
Line 111: Line 117:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
== See also ==
+
== 같이보기 ==
 
* [http://www.freepascal.org/docs-html/fcl/zipper/index.html official FPC documentation for Zipper]
 
* [http://www.freepascal.org/docs-html/fcl/zipper/index.html official FPC documentation for Zipper]
 
* [http://www.freepascal.org/~michael/articles/archives/archives.pdf] Article demonstrating handling tar, bzip2, gzip, zip files and Blowfish encryption in FreePascal/Lazarus. A good introduction even though it was written some time ago (a lot of functionality has been improved).
 
* [http://www.freepascal.org/~michael/articles/archives/archives.pdf] Article demonstrating handling tar, bzip2, gzip, zip files and Blowfish encryption in FreePascal/Lazarus. A good introduction even though it was written some time ago (a lot of functionality has been improved).
Line 119: Line 125:
  
 
Go back to [[Package_List|Packages List]]
 
Go back to [[Package_List|Packages List]]
 
[[Category:Tutorials]]
 
[[Category:FPC]]
 
[[Category:Lazarus]]
 
[[Category:Packages]]
 

Latest revision as of 06:53, 23 February 2020

Deutsch (de) English (en) 한국어 (ko) polski (pl) русский (ru)

paszlib is a Pascal conversion of the standard zlib library: you don't need any external dependencies. It was implemented by Jacques Nomssi Nzali (his old homepage is dead, see a continuation of the project here). It is used in the FCL to implement the TCompressionStream class.

This class lets you compress and decompress .zip files.

The main unit of this package is paszlib. There are other, auxiliary units, but the only unit that needs to be included in a typical program is this one.

TZipper

TZipper은 압축 .zip 파일을 압축 해제에 대한 지원을 하지만 모든 압축 방식을 지원하지 않습니다.

문서

더보기 official FPC documentation for Zipper

예제

Zip 파일 생성

첫번째 인수에 파일이름을 입력하여 zip 파일을 생성할 수 있습니다. 이후 인자 파일이름을 추가하여 zip파일에 포함합니다.

다음은 생성하는 예입니다.

zipper newzip.zip autoexec.bat config.sys
uses
  Zipper;
var
  OurZipper: TZipper;
  I: Integer;
begin
  OurZipper := TZipper.Create;
  try
    OurZipper.FileName := ParamStr(1);
    for I := 2 to ParamCount do
      OurZipper.Entries.AddFileEntry(ParamStr(I), ParamStr(I));
    OurZipper.ZipAllFiles;
  finally
    OurZipper.Free;
  end;
end.

Zip 압축 풀기

c:\test.zip 압축파일의 모든 파일을 c:\windows\temp\ 디렉토리에 풀기

uses
  Zipper;
var
  UnZipper: TUnZipper;
begin
  UnZipper := TUnZipper.Create;
  try    
    UnZipper.FileName := 'c:\test.zip';
    UnZipper.OutputPath := 'c:\windows\temp';
    UnZipper.Examine;
    UnZipper.UnZipAllFiles;
  finally
    UnZipper.Free;
  end;
end.

More examples can be found in the FPC source directory:

  • examples: [1]
  • the test program: [2]

스트림 파일 압축 풀기

라자루스 폼위에 TMemo, TButton, TEdit, TFileNameEdit 를 올립니다.

버튼을 클릭하면 FileNameEdit에서 zip 파일을 읽어, Edit박스에 입력된 파일을 압축해제 합니다.

그리고 압축 내용을 Memo에 출력합니다.

uses
  Zipper;

...

procedure TForm1.Button1Click(Sender: TObject);
begin
  ExtractFileFromZip(FileNameEdit1.FileName,Edit1.Text);
end;

procedure TForm1.DoCreateOutZipStream(Sender: TObject; var AStream: TStream;
  AItem: TFullZipFileEntry);
begin
  AStream:=TMemorystream.Create;
end;

procedure TForm1.DoDoneOutZipStream(Sender: TObject; var AStream: TStream;
  AItem: TFullZipFileEntry);
begin
  AStream.Position:=0;
  Memo1.lines.LoadFromStream(Astream);
  Astream.Free;
end;

procedure TForm1.ExtractFileFromZip(ZipName, FileName: string);
var
  ZipFile: TUnZipper;
  sl:TStringList;
begin
  sl:=TStringList.Create;
  sl.Add(FileName);
  ZipFile := TUnZipper.Create;
  try
    ZipFile.FileName := ZipName;
    ZipFile.OnCreateStream := @DoCreateOutZipStream;
    ZipFile.OnDoneStream:=@DoDoneOutZipStream;
    ZipFile.UnZipFiles(sl);
  finally
    ZipFile.Free;
    sl.Free;
  end;
end;

같이보기

  • official FPC documentation for Zipper
  • [3] Article demonstrating handling tar, bzip2, gzip, zip files and Blowfish encryption in FreePascal/Lazarus. A good introduction even though it was written some time ago (a lot of functionality has been improved).
  • unzip
  • FreePascalArchivePackage Abbrevia archive/zip library
  • [4] MIT licensed Delphi/Object Pascal library that includes zip file support.

Go back to Packages List