doc/neko/zip
Differences between version #5872 and #5873
3c3
< This tutorial demonstrates how to use zip and tar files in Haxe/Neko. The ''neko.zip'' can be used to read and write to compressed archives. The important methods are in ''neko.zip.Reader'', ''neko.zip.Writer'', and ''neko.zip.ZipEntry''.
---
> This tutorial demonstrates how to use zip and tar files in Haxe/Neko. The ''neko.zip'' package can be used to read from and write to compressed archives. The important sections in the API are ''neko.zip.Reader'', ''neko.zip.Writer'', and ''neko.zip.ZipEntry''.
7c7
< The program operates on an existing zip and tar gz file. Since the example outputs the file contents to the screen it would be best to create an example file for it to use. Create a directory named "data" in the current directory. In the "data" directory, create a text file named "file1.txt" containing "this is a file." Now create a text file in the "data" directory named "file2.txt" containing "this is another file."
---
> The program operates on an existing zip and tar gz file. The program should work on any valid zip and tar gz files, but since the example outputs the files contents to the screen it would be best to create small example files for it to use. Create a directory named "data" in the current directory. Create a text file named "file1.txt" containing "this is a file" in the "data" directory. Then create a text file named "file2.txt" containing "this is another file" also in the "data" directory.
16c16
< Use any zip program to create a zip archive of the "data" directory named "data.zip." Also create a tar gz archive of it named "data.tgz."
---
> Use any zip program to create a zip archive of the "data" directory named "data.zip." Also create a tar gz archive of it named "data.tgz." Windows users without a "tar" program can run this tutorial by commenting out the three lines of ''main'' that calls ''readTar'' and outputs its content.
32c32
< The code is separated into several functions. We'll go over each in detail.
---
> The code is separated into several functions. We will go over each in detail.
36c36
< The main function makes several function calls that basically match the walkthrough. Note that data structures returned from reading zip or tar archives (''archiveData'' in the code below) can be treated the same way.
---
> The main function makes several function calls that basically match the walkthrough. Note that data structures returned from reading zip or tar archives (''archiveData'' in the code below) can be used interchangeably.
78c78
< The ''readTar'' is nearly the same as ''readZip'', except that it uses a different method from the ''neko.zip.Reader'' class. The second argument of the ''readTar'' method indicates that the input file is gzipped.
---
> The ''readTar'' is nearly the same as ''readZip'', except that it uses a different method from the ''neko.zip.Reader'' class. The second argument of the ''readTar'' method indicates that the input file is gzipped since its value is ''true''.
92c92
< This function outputs the file name and content for each entry read from the input file. A file's content is compressed if its ''compressed'' field is set to true. We unzip compressed data before outputting it.
---
> This function outputs the file name and content for each entry read from the input file. A file's content is compressed if its ''compressed'' field is set to ''true''. We decompress compressed data before outputting it.
108c108
< - it uncompresses compressed data since the data passed into ''neko.zip.Writer.writeZip'' should not already be compressed
---
> - it decompresses compressed data since the data passed into ''neko.zip.Writer.writeZip'' should not already be compressed
132c132
< Note that ''neko.zip.Reader'' must be imported since it defines the ''neko.zip.ZipEntry'' type.
---
> ''neko.zip.Reader'' must be imported since it defines the ''neko.zip.ZipEntry'' type.
135a136
> import neko.zip.Writer;
| Ver | Date | Lg | User | Action |
|---|---|---|---|---|
| #14380 | 2012-07-08 15:23:02 | en | cambiata | View | Diff |
| #14379 | 2012-07-08 15:22:28 | en | cambiata | View | Diff |
| #14378 | 2012-07-08 15:22:28 | en | cambiata | Changed title from Zip and Tar Gz archives to neko.zip: Zip and Tar Gz archives |
| #5873 | 2009-04-29 23:31:52 | en | ianxm | View | Diff |
| #5872 | 2009-04-29 23:10:30 | en | ianxm | View | Diff |
| #5871 | 2009-04-29 23:10:30 | en | ianxm | Set title to Zip and Tar Gz archives |
Previous | Next