the title is not clear.
// 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:)