<?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;
}
?>
Bzip2 함수 목록
Table of Contents
- bzclose — bzip2 파일 닫기
- bzcompress — 문자열을 bzip2 인코드 데이터로 압축
- bzdecompress — bzip2 인코드 데이터의 압축 해제
- bzerrno — bzip2 오류 번호 반환
- bzerror — bzip2 오류 번호와 오류 문자열을 배열로 반환
- bzerrstr — bzip2 오류 문자열을 반환
- bzflush — 버퍼에 담긴 모든 데이터를 강제 기록
- bzopen — bzip2 압축 파일 열기
- bzread — 바이너리 안전 bzip2 파일 읽기
- bzwrite — 바이너리 안전 bzip2 파일 쓰기
Bzip2 함수 목록
ec10 at gmx dot net
21-May-2004 03:34
21-May-2004 03:34
