J F W

making web application programming easier is possible

HOW TO : CORE

manage normal and zipped files

To save a file, you can use this code:

You have to create an instance of class SaveFile and pass as parameter the name and the path of the file. Then, if you want to save a text file you use the method saveTextFile. To save a binary file, the method saveBinaryFile has to be used.

To read the previous file, you can use this code:

You have to create an instance of class ReadFile and pass as parameter the name and path of the file to read. For reading a text file, you use the method readTextFile and for reading a binary file, the method readBinaryFile.

Here is the code for creating a zip file:

All you have to do is to create an instance of class ZipFile giving the name and the path for the zip file. Then you can use one or both the add method for add files. The add method with the two parameters permits to add the file using a different name and path from the physical one.

And here is the code for unzipping the previous file:

You have to create an instance of class UnzipFile giving the name and the path of the zip file. Then using the method extract you can extract the file into the given path.

You can also use the method addFile one or more times to set the names of the files you want to extract. When you have finished seting the names of the files to extract, you use the method extractFiles to extract only these files.