PHP
downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

bzclose> <예제
Last updated: Fri, 30 Jan 2009

view this page in

Bzip2 함수 목록

Table of Contents

  • bzclose — bzip2 파일 닫기
  • bzcompress — 문자열을 bzip2 인코드 데이터로 압축
  • bzdecompress — bzip2 인코드 데이터의 압축 해제
  • bzerrno — bzip2 오류 번호 반환
  • bzerror — bzip2 오류 번호와 오류 문자열을 배열로 반환
  • bzerrstr — bzip2 오류 문자열을 반환
  • bzflush — 버퍼에 담긴 모든 데이터를 강제 기록
  • bzopen — bzip2 압축 파일 열기
  • bzread — 바이너리 안전 bzip2 파일 읽기
  • bzwrite — 바이너리 안전 bzip2 파일 쓰기


add a note add a note User Contributed Notes
Bzip2 함수 목록
ec10 at gmx dot net
20-May-2004 09:34
<?php
/**
 * @return bool
 * @param string $in
 * @param string $out
 * @desc compressing the file with the bzip2-extension
*/
function bzip2 ($in, $out)
{
    if (!
file_exists ($in) || !is_readable ($in))
        return
false;
    if ((!
file_exists ($out) && !is_writeable (dirname ($out)) || (file_exists($out) && !is_writable($out)) ))
        return
false;
   
   
$in_file = fopen ($in, "rb");
   
$out_file = bzopen ($out, "wb");
   
    while (!
feof ($in_file)) {
       
$buffer = fgets ($in_file, 4096);
        
bzwrite ($out_file, $buffer, 4096);
    }

   
fclose ($in_file);
   
bzclose ($out_file);
   
    return
true;
}

/**
 * @return bool
 * @param string $in
 * @param string $out
 * @desc uncompressing the file with the bzip2-extension
*/
function bunzip2 ($in, $out)
{
    if (!
file_exists ($in) || !is_readable ($in))
        return
false;
    if ((!
file_exists ($out) && !is_writeable (dirname ($out)) || (file_exists($out) && !is_writable($out)) ))
        return
false;

   
$in_file = bzopen ($in, "rb");
   
$out_file = fopen ($out, "wb");

    while (
$buffer = bzread ($in_file, 4096)) {
       
fwrite ($out_file, $buffer, 4096);
    }
 
   
bzclose ($in_file);
   
fclose ($out_file);
   
    return
true;
}
?>

bzclose> <예제
Last updated: Fri, 30 Jan 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites