mirror of
https://github.com/php/doc-ja.git
synced 2026-03-24 07:02:08 +01:00
119 lines
3.5 KiB
XML
119 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: d51166ca16fda8e766849505b84f9306ef443f71 Maintainer: masakielastic Status: ready -->
|
|
<refentry xml:id="spltempfileobject.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>SplTempFileObject::__construct</refname>
|
|
<refpurpose>新しい一時ファイルオブジェクトを作成する</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<constructorsynopsis role="SplTempFileObject">
|
|
<modifier>public</modifier> <methodname>SplTempFileObject::__construct</methodname>
|
|
<methodparam choice="opt"><type>int</type><parameter>maxMemory</parameter><initializer>2 * 1024 * 1024</initializer></methodparam>
|
|
</constructorsynopsis>
|
|
<para>
|
|
新しい一時ファイルオブジェクトを作成します。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>maxMemory</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
一時ファイルに使うメモリの最大量(バイト単位、デフォルトは 2 MB)。
|
|
一時ファイルがこのサイズを越える場合、ファイルはシステムの一時ディレクトリに移動させられます。
|
|
</para>
|
|
<para>
|
|
<parameter>maxMemory</parameter> が負の値である場合、
|
|
メモリだけが使われます。<parameter>maxMemory</parameter>
|
|
がゼロの場合、メモリは使われません。
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="errors">
|
|
&reftitle.errors;
|
|
<para>
|
|
エラーが起きる場合 <classname>RuntimeException</classname> がスローされます。
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title><methodname>SplTempFileObject</methodname> の例</title>
|
|
<para>この例では読み書きできるメモリで一時ファイルが書き込まれます。</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$temp = new SplTempFileObject();
|
|
$temp->fwrite("これは最初の行で\n");
|
|
$temp->fwrite("そしてこれは 2 番目の行です。\n");
|
|
echo "一時ファイルに " . $temp->ftell() . " バイトが書き込まれました。\n\n";
|
|
|
|
// 先頭に巻き戻し、書かれた内容を読み取る
|
|
$temp->rewind();
|
|
foreach ($temp as $line) {
|
|
echo $line;
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
一時ファイルに 47 バイト書き込まれました。
|
|
|
|
これは最初の行で
|
|
そしてこれは 2 番目の行です。
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><classname>SplFileObject</classname></member>
|
|
<member>
|
|
<link linkend="wrappers.php">PHP 入出力ストリーム</link>
|
|
(<literal>php://temp</literal> および <literal>php://memory</literal> について)
|
|
</member>
|
|
</simplelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
</refentry>
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|