<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >PharFileInfo->setCompressedBZIP2</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Phar archive stream and classes" HREF="ref.phar.html"><LINK REL="PREVIOUS" TITLE="PharFileInfo->isCRCChecked" HREF="function.pharfileinfo-iscrcchecked.html"><LINK REL="NEXT" TITLE="PharFileInfo->setCompressedGZ" HREF="function.pharfileinfo-setcompressedgz.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.pharfileinfo-iscrcchecked.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.pharfileinfo-setcompressedgz.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.pharfileinfo-setcompressedbzip2" ></A >PharFileInfo->setCompressedBZIP2</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN175575" ></A ><P > (no version information, might be only in CVS)</P >PharFileInfo->setCompressedBZIP2 -- Compresses the current Phar entry within the phar using Bzip2 compression</DIV ><DIV CLASS="refsect1" ><A NAME="AEN175578" ></A ><H2 >Descrição</H2 >bool <B CLASS="methodname" >PharFileInfo->setCompressedBZIP2</B > ( void )<BR ></BR ><P > This method compresses the file inside the Phar archive using bzip2 compression. The <A HREF="ref.bzip2.html" >bzip2</A > extension must be enabled to take advantage of this feature. In addition, if the file is already compressed using gzip compression, the <A HREF="ref.zlib.html" >zlib</A > extension must be enabled in order to decompress the file. As with all functionality that modifies the contents of a phar, the <A HREF="ref.phar.html#ini.phar.readonly" >phar.readonly</A > INI variable must be off in order to succeed. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN175588" ></A ><H2 >Erros/Excessões</H2 ><P > Throws <B CLASS="classname" >BadMethodCallException</B > if the <A HREF="ref.phar.html#ini.phar.readonly" >phar.readonly</A > INI variable is on, or if the <A HREF="ref.bzip2.html" >bzip2</A > extension is not available. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN175594" ></A ><H2 >Exemplos</H2 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN175597" ></A ><P ><B >Exemplo 1. A <B CLASS="function" >PharFileInfo->setCompressedBZIP2()</B > example</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />try </font><font color="#007700">{<br /> </font><font color="#0000BB">$p </font><font color="#007700">= new </font><font color="#0000BB">Phar</font><font color="#007700">(</font><font color="#DD0000">'/path/to/my.phar'</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#DD0000">'my.phar'</font><font color="#007700">);<br /> </font><font color="#0000BB">$p</font><font color="#007700">[</font><font color="#DD0000">'myfile.txt'</font><font color="#007700">] = </font><font color="#DD0000">'hi'</font><font color="#007700">;<br /> </font><font color="#0000BB">$file </font><font color="#007700">= </font><font color="#0000BB">$p</font><font color="#007700">[</font><font color="#DD0000">'myfile.txt'</font><font color="#007700">];<br /> </font><font color="#0000BB">var_dump</font><font color="#007700">(</font><font color="#0000BB">$file</font><font color="#007700">-></font><font color="#0000BB">isCompressedBZIP2</font><font color="#007700">());<br /> </font><font color="#0000BB">$p</font><font color="#007700">[</font><font color="#DD0000">'myfile.txt'</font><font color="#007700">]-></font><font color="#0000BB">setCompressedBZIP2</font><font color="#007700">();<br /> </font><font color="#0000BB">var_dump</font><font color="#007700">(</font><font color="#0000BB">$file</font><font color="#007700">-></font><font color="#0000BB">isCompressedBZIP2</font><font color="#007700">());<br />} </font><font color="#0000BB">catch </font><font color="#007700">(</font><font color="#0000BB">Exception $e</font><font color="#007700">) {<br /> echo </font><font color="#DD0000">'Create/modify operations on my.phar failed: '</font><font color="#007700">, </font><font color="#0000BB">$e</font><font color="#007700">;<br />}<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P >O exemplo acima irá imprimir:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >bool(false) bool(true)</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN175603" ></A ><H2 >Veja também</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.pharfileinfo-getcompressedsize.html" ><B CLASS="function" >PharFileInfo->getCompressedSize()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.pharfileinfo-iscompressedgz.html" ><B CLASS="function" >PharFileInfo->isCompressedGZ()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.pharfileinfo-iscompressed.html" ><B CLASS="function" >PharFileInfo->isCompressed()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.pharfileinfo-setcompressedgz.html" ><B CLASS="function" >PharFileInfo->isCompressedGZ()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.pharfileinfo-setuncompressed.html" ><B CLASS="function" >PharFileInfo->isCompressed()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.phar-compressallfilesbzip2.html" ><B CLASS="function" >Phar->compressAllFilesBZIP2()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.pharfileinfo-iscrcchecked.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.pharfileinfo-setcompressedgz.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >PharFileInfo->isCRCChecked</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.phar.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >PharFileInfo->setCompressedGZ</TD ></TR ></TABLE ></DIV ></BODY ></HTML >