paszlib/ko: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: paszlib/ko
| Old | New | Line | |
|---|---|---|---|
| 1 | + | **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](http://sageshome.net/oss/paszlib-sg.php)). It is used in the FCL to implement the TCompressionStream class. | |
| 2 | + | ||
| 3 | + | This class lets you compress and decompress **.zip** files. | |
| 4 | + | ||
| 5 | + | 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. | |
| 6 | + | ||
| 7 | + | ## TZipper | |
| 8 | + | ||
| 9 | + | TZipper은 압축 .zip 파일을 압축 해제에 대한 지원을 하지만 모든 압축 방식을 지원하지 않습니다. | |
| 10 | + | ||
| 11 | + | ### 문서 | |
| 12 | + | ||
| 13 | + | 더보기 [official FPC documentation for Zipper](http://www.freepascal.org/docs-html/fcl/zipper/index.html) | |
| 14 | + | ||
| 15 | + | ### 예제 | |
| 16 | + | ||
| 17 | + | #### Zip 파일 생성 | |
| 18 | + | ||
| 19 | + | 첫번째 인수에 파일이름을 입력하여 zip 파일을 생성할 수 있습니다. 이후 인자 파일이름을 추가하여 zip파일에 포함합니다. | |
| 20 | + | ||
| 21 | + | 다음은 생성하는 예입니다. | |
| 22 | + | ||
| 23 | + | ```dos | |
| 24 | + | zipper newzip.zip autoexec.bat config.sys | |
| 25 | + | ``` | |
| 26 | + | ||
| 27 | + | ``` pascal | |
| 28 | + | uses | |
| 29 | + | Zipper; | |
| 30 | + | var | |
| 31 | + | OurZipper: TZipper; | |
| 32 | + | I: Integer; | |
| 33 | + | begin | |
| 34 | + | OurZipper := TZipper.Create; | |
| 35 | + | try | |
| 36 | + | OurZipper.FileName := ParamStr(1); | |
| 37 | + | for I := 2 to ParamCount do | |
| 38 | + | OurZipper.Entries.AddFileEntry(ParamStr(I), ParamStr(I)); | |
| 39 | + | OurZipper.ZipAllFiles; | |
| 40 | + | finally | |
| 41 | + | OurZipper.Free; | |
| 42 | + | end; | |
| 43 | + | end. | |
| 44 | + | ``` | |
| 45 | + | ||
| 46 | + | #### Zip 압축 풀기 | |
| 47 | + | ||
| 48 | + | c:\test.zip 압축파일의 모든 파일을 c:\windows\temp\\ 디렉토리에 풀기 | |
| 49 | + | ||
| 50 | + | ``` pascal | |
| 51 | + | uses | |
| 52 | + | Zipper; | |
| 53 | + | var | |
| 54 | + | UnZipper: TUnZipper; | |
| 55 | + | begin | |
| 56 | + | UnZipper := TUnZipper.Create; | |
| 57 | + | try | |
| 58 | + | UnZipper.FileName := 'c:\test.zip'; | |
| 59 | + | UnZipper.OutputPath := 'c:\windows\temp'; | |
| 60 | + | UnZipper.Examine; | |
| 61 | + | UnZipper.UnZipAllFiles; | |
| 62 | + | finally | |
| 63 | + | UnZipper.Free; | |
| 64 | + | end; | |
| 65 | + | end. | |
| 66 | + | ``` | |
| 67 | + | ||
| 68 | + | More examples can be found in the FPC source directory: | |
| 69 | + | ||
| 70 | + | - examples: [1](http://svn.freepascal.org/svn/fpc/trunk/packages/paszlib/examples/) | |
| 71 | + | - the test program: [2](http://svn.freepascal.org/svn/fpc/trunk/packages/paszlib/tests) | |
| 72 | + | ||
| 73 | + | #### 스트림 파일 압축 풀기 | |
| 74 | + | ||
| 75 | + | 라자루스 폼위에 TMemo, TButton, TEdit, TFileNameEdit 를 올립니다. | |
| 76 | + | ||
| 77 | + | 버튼을 클릭하면 FileNameEdit에서 zip 파일을 읽어, Edit박스에 입력된 파일을 압축해제 합니다. | |
| 78 | + | ||
| 79 | + | 그리고 압축 내용을 Memo에 출력합니다. | |
| 80 | + | ||
| 81 | + | ``` pascal | |
| 82 | + | uses | |
| 83 | + | Zipper; | |
| 84 | + | ||
| 85 | + | ... | |
| 86 | + | ||
| 87 | + | procedure TForm1.Button1Click(Sender: TObject); | |
| 88 | + | begin | |
| 89 | + | ExtractFileFromZip(FileNameEdit1.FileName,Edit1.Text); | |
| 90 | + | end; | |
| 91 | + | ||
| 92 | + | procedure TForm1.DoCreateOutZipStream(Sender: TObject; var AStream: TStream; | |
| 93 | + | AItem: TFullZipFileEntry); | |
| 94 | + | begin | |
| 95 | + | AStream:=TMemorystream.Create; | |
| 96 | + | end; | |
| 97 | + | ||
| 98 | + | procedure TForm1.DoDoneOutZipStream(Sender: TObject; var AStream: TStream; | |
| 99 | + | AItem: TFullZipFileEntry); | |
| 100 | + | begin | |
| 101 | + | AStream.Position:=0; | |
| 102 | + | Memo1.lines.LoadFromStream(Astream); | |
| 103 | + | Astream.Free; | |
| 104 | + | end; | |
| 105 | + | ||
| 106 | + | procedure TForm1.ExtractFileFromZip(ZipName, FileName: string); | |
| 107 | + | var | |
| 108 | + | ZipFile: TUnZipper; | |
| 109 | + | sl:TStringList; | |
| 110 | + | begin | |
| 111 | + | sl:=TStringList.Create; | |
| 112 | + | sl.Add(FileName); | |
| 113 | + | ZipFile := TUnZipper.Create; | |
| 114 | + | try | |
| 115 | + | ZipFile.FileName := ZipName; | |
| 116 | + | ZipFile.OnCreateStream := @DoCreateOutZipStream; | |
| 117 | + | ZipFile.OnDoneStream:=@DoDoneOutZipStream; | |
| 118 | + | ZipFile.UnZipFiles(sl); | |
| 119 | + | finally | |
| 120 | + | ZipFile.Free; | |
| 121 | + | sl.Free; | |
| 122 | + | end; | |
| 123 | + | end; | |
| 124 | + | ``` | |
| 125 | + | ||
| 126 | + | ## 같이보기 | |
| 127 | + | ||
| 128 | + | - [official FPC documentation for Zipper](http://www.freepascal.org/docs-html/fcl/zipper/index.html) | |
| 129 | + | - [3](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). | |
| 130 | + | - [[unzip]] | |
| 131 | + | - [[FreePascalArchivePackage]] Abbrevia archive/zip library | |
| 132 | + | - [4](http://code.google.com/p/kstools/) MIT licensed Delphi/Object Pascal library that includes zip file support. | |
| 133 | + | ||
| 134 | + | Go back to [[Package List|Packages List]] | |
| 135 | + | ||
| 136 | + | --- | |
| 137 | + | *From the Free Pascal wiki, page "paszlib/ko", as it stood on 2020-02-23 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).* |
