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

search for in the

bzwrite> <bzopen
Last updated: Fri, 13 Nov 2009

view this page in

bzread

(PHP 4 >= 4.0.4, PHP 5)

bzreadバイナリ対応の bzip2 ファイル読み込み

説明

string bzread ( resource $bz [, int $length = 1024 ] )

bzread() は、与えられた bzip2 ファイルポインタから読み込みます。

読み込みは、(圧縮前の状態で) length バイトが読み込まれたか、EOF に達したかのどちらか最初に来た方で終了します。

パラメータ

bz

ファイルポインタ。これは有効である必要があり、 bzopen() によりオープンされたファイルを指してい る必要があります。

length

指定されない場合、bzread() は一度に (圧縮前の状態で) 1024バイト読み込みます。

返り値

非圧縮データ、もしくはエラー時に FALSE を返します。

例1 bzread() の例

<?php

$file 
"/tmp/foo.bz2";
$bz bzopen($file"r") or die("Couldn't open $file");

$decompressed_file '';
while (!
feof($bz)) {
  
$decompressed_file .= bzread($bz4096);
}
bzclose($bz);

echo 
"The contents of $file are: <br />\n";
echo 
$decompressed_file;

?>

参考

  • bzwrite() - バイナリ対応の bzip2 ファイルへの書き込み
  • feof() - ファイルポインタがファイル終端に達しているかどうか調べる
  • bzopen() - bzip2 圧縮されたファイルをオープンする



add a note add a note User Contributed Notes
bzread
bitlz at mail dot ru
05-Aug-2004 02:02
max value of length is 8192 (2^13).
if length is more than 8192 bzread understand as 8192. :)

ps. php 5.0.0 under win2k sp4.

bzwrite> <bzopen
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites