<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.quickhashinthash.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'es',
  ),
  'this' => 
  array (
    0 => 'quickhashinthash.loadfromfile.php',
    1 => 'QuickHashIntHash::loadFromFile',
    2 => 'Este m&eacute;todo de f&aacute;brica crea un hash a partir de un fichero',
  ),
  'up' => 
  array (
    0 => 'class.quickhashinthash.php',
    1 => 'QuickHashIntHash',
  ),
  'prev' => 
  array (
    0 => 'quickhashinthash.getsize.php',
    1 => 'QuickHashIntHash::getSize',
  ),
  'next' => 
  array (
    0 => 'quickhashinthash.loadfromstring.php',
    1 => 'QuickHashIntHash::loadFromString',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/quickhash/quickhashinthash/loadfromfile.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="quickhashinthash.loadfromfile" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">QuickHashIntHash::loadFromFile</h1>
  <p class="verinfo">(PECL quickhash &gt;= Unknown)</p><p class="refpurpose"><span class="refname">QuickHashIntHash::loadFromFile</span> &mdash; <span class="dc-title">Este método de fábrica crea un hash a partir de un fichero</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-quickhashinthash.loadfromfile-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>QuickHashIntHash::loadFromFile</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$options</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="class.quickhashinthash.php" class="type QuickHashIntHash">QuickHashIntHash</a></span></div>

  <p class="simpara">
   Este método de fábrica crea un nuevo hash a partir de un fichero de definición en disco. El
   formato de fichero consiste en una firma <code class="literal">&#039;QH\0x11\0&#039;</code>, el número de elementos como
   un entero de 32 bits con signo en Endianness de sistema, seguido de enteros de 32 bits con signo empaquetados juntos
   en el Endianness que el sistema en el que se ejecuta el código utiliza. Para cada elemento de hash, hay dos enteros de 32 bits con signo
   almacenados. El primero de cada elemento es la clave, y el segundo es el valor
   perteneciente a la clave. Un ejemplo podría ser:
  </p>
  <div class="example" id="example-1">
   <p><strong>Ejemplo #1 Formato de fichero QuickHash IntHash</strong></p>
   <div class="example-contents screen"><div class="descriptioncode"><pre class="descriptioncode">00000000  51 48 11 00 02 00 00 00  01 00 00 00 01 00 00 00  |QH..............|
00000010  03 00 00 00 09 00 00 00                           |........|
00000018</pre>
</div></div>
  </div>
  <div class="example" id="example-2">
   <p><strong>Ejemplo #2 Formato de fichero QuickHash IntHash</strong></p>
   <div class="example-contents screen"><div class="descriptioncode"><pre class="descriptioncode">firma de encabezado (&#039;QH&#039;; tipo de clave: 1; tipo de valor: 1; relleno: \0x00)
00000000  51 48 11 00

número de elementos:
00000004  02 00 00 00

cadena de datos:
00000000  01 00 00 00 01 00 00 00  03 00 00 00 09 00 00 00

clave/valor 1 (clave = 1, valor = 1)
01 00 00 00  01 00 00 00

clave/valor 2 (clave = 3, valor = 9)
03 00 00 00  09 00 00 00</pre>
</div></div>
  </div>

 </div>


 <div class="refsect1 parameters" id="refsect1-quickhashinthash.loadfromfile-parameters">
  <h3 class="title">Parámetros</h3>
  <dl>
   
    <dt><code class="parameter">filename</code></dt>
    <dd>
     <span class="simpara">
      El nombre del fichero desde el cual leer el hash.
     </span>
    </dd>
   
   
    <dt><code class="parameter">options</code></dt>
    <dd>
     <span class="simpara">
      Las mismas opciones que el constructor de la clase; con la excepción de la opción
      size que es ignorada. Se calcula automáticamente para ser la misma que el
      número de entradas en el hash, redondeada a la potencia de dos más cercana
      con un límite máximo de <code class="literal">4194304</code>.
     </span>
    </dd>
   
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-quickhashinthash.loadfromfile-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="simpara">
   Devuelve un nuevo <span class="classname"><a href="class.quickhashinthash.php" class="classname">QuickHashIntHash</a></span>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-quickhashinthash.loadfromfile-examples">
  <h3 class="title">Ejemplos</h3>
  <div class="example" id="example-3">
   <p><strong>Ejemplo #3 Ejemplo de <span class="function"><strong>QuickHashIntHash::loadFromFile()</strong></span></strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$file </span><span style="color: #007700">= </span><span style="color: #0000BB">dirname</span><span style="color: #007700">( </span><span style="color: #0000BB">__FILE__ </span><span style="color: #007700">) . </span><span style="color: #DD0000">"/simple.hash"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$hash </span><span style="color: #007700">= </span><span style="color: #0000BB">QuickHashIntHash</span><span style="color: #007700">::</span><span style="color: #0000BB">loadFromFile</span><span style="color: #007700">(<br />    </span><span style="color: #0000BB">$file</span><span style="color: #007700">,<br />    </span><span style="color: #0000BB">QuickHashIntHash</span><span style="color: #007700">::</span><span style="color: #0000BB">DO_NOT_USE_ZEND_ALLOC<br /></span><span style="color: #007700">);<br />foreach( </span><span style="color: #0000BB">range</span><span style="color: #007700">( </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">0x0f </span><span style="color: #007700">) as </span><span style="color: #0000BB">$key </span><span style="color: #007700">)<br />{<br />    </span><span style="color: #0000BB">printf</span><span style="color: #007700">( </span><span style="color: #DD0000">"Key %3d (%2x) is %s\n"</span><span style="color: #007700">,<br />        </span><span style="color: #0000BB">$key</span><span style="color: #007700">, </span><span style="color: #0000BB">$key</span><span style="color: #007700">,<br />        </span><span style="color: #0000BB">$hash</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">exists</span><span style="color: #007700">( </span><span style="color: #0000BB">$key </span><span style="color: #007700">) ? </span><span style="color: #DD0000">'set' </span><span style="color: #007700">: </span><span style="color: #DD0000">'unset'<br />    </span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Resultado del ejemplo anterior es similar a:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Key   0 ( 0) is unset
Key   1 ( 1) is set
Key   2 ( 2) is set
Key   3 ( 3) is set
Key   4 ( 4) is unset
Key   5 ( 5) is set
Key   6 ( 6) is unset
Key   7 ( 7) is set
Key   8 ( 8) is unset
Key   9 ( 9) is unset
Key  10 ( a) is unset
Key  11 ( b) is set
Key  12 ( c) is unset
Key  13 ( d) is set
Key  14 ( e) is unset
Key  15 ( f) is unset</pre>
</div>
   </div>
  </div>
 </div>


</div><?php manual_footer($setup); ?>