[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pdt-dev] a question about decompressing a compressd file in phar

the title is not clear.

i describe the question here:

i execute the following code to compress the file in phar(pure phar,neither zip nor gz)

ÂÂ Â// open an existing phar
ÂÂ Â$p = new Phar('coollibrary.phar', 0);
ÂÂ Â// Phar extends SPL's DirectoryIterator class
ÂÂ Âforeach (new RecursiveIteratorIterator($p) as $file) {
ÂÂ Â Â Â// $file is a PharFileInfo class, and inherits from SplFileInfo
ÂÂ Â Â Âecho $file->getFileName() . "\n";
ÂÂ Â Â Âecho file_get_contents($file->getPathName()) . "\n"; // display contents;
ÂÂ Âif (Phar::canCompress(Phar::GZ)) {
ÂÂ Â Â Â Â Â$p[$file->getFileName()]->compress(Phar::GZ);

and then i wrote a java class to extract the data in the phar(coollibrary.phar),i could get the ÂcompressedÂtype(zlib) , the hash code , the file's compressed and unÂcompressedÂsize ,and theÂcompressed content.it is important to notice it is not a "gz" file,and it is possible not all files in the phar are compressed.
so i need to check the files one by one,and then decompress theÂcompressedÂfiles one by one.

is there any existing method to use.or i have to find the compress/uncompress algorithm andÂuncompress the file myself?

thank you for your answer.
and hint will beÂappreciated:)