<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Module: ByteOrder</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> <script type="text/javascript"> // <![CDATA[ function popupCode( url ) { window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") } function toggleCode( id ) { if ( document.getElementById ) elem = document.getElementById( id ); else if ( document.all ) elem = eval( "document.all." + id ); else return false; elemStyle = elem.style; if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else { elemStyle.display = "none" } return true; } // Make codeblocks hidden by default document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) // ]]> </script> </head> <body> <div id="classHeader"> <table class="header-table"> <tr class="top-aligned-row"> <td><strong>Module</strong></td> <td class="class-name-in-header">ByteOrder</td> </tr> <tr class="top-aligned-row"> <td><strong>In:</strong></td> <td> <a href="../files/lib/carat/byteorder_rb.html"> lib/carat/byteorder.rb </a> <br /> </td> </tr> </table> </div> <!-- banner header --> <div id="bodyContent"> <div id="contextContent"> <div id="description"> <p> by Michael Neumann </p> </div> </div> <div id="method-list"> <h3 class="section-bar">Methods</h3> <div class="name-list"> <a href="#M000593">big?</a> <a href="#M000591">big_endian?</a> <a href="#M000588">byte_order</a> <a href="#M000589">byteorder</a> <a href="#M000592">little?</a> <a href="#M000590">little_endian?</a> <a href="#M000594">network?</a> </div> </div> </div> <!-- if includes --> <div id="section"> <div id="constants-list"> <h3 class="section-bar">Constants</h3> <div class="name-list"> <table summary="Constants"> <tr class="top-aligned-row context-row"> <td class="context-item-name">Native</td> <td>=</td> <td class="context-item-value">:Native</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">BigEndian</td> <td>=</td> <td class="context-item-value">Big = Network = :BigEndian</td> </tr> <tr class="top-aligned-row context-row"> <td class="context-item-name">LittleEndian</td> <td>=</td> <td class="context-item-value">Little = :LittleEndian</td> </tr> </table> </div> </div> <!-- if method_list --> <div id="methods"> <h3 class="section-bar">Public Instance methods</h3> <div id="method-M000593" class="method-detail"> <a name="M000593"></a> <div class="method-heading"> <span class="method-name">big?</span><span class="method-args">()</span> </div> <div class="method-description"> <p> Alias for <a href="ByteOrder.html#M000591">big_endian?</a> </p> </div> </div> <div id="method-M000591" class="method-detail"> <a name="M000591"></a> <div class="method-heading"> <a href="#M000591" class="method-signature"> <span class="method-name">big_endian?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" onclick="toggleCode('M000591-source');return false;">[Source]</a></p> <div class="method-source-code" id="M000591-source"> <pre> <span class="ruby-comment cmt"># File lib/carat/byteorder.rb, line 23</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">big_endian?</span> <span class="ruby-identifier">byte_order</span> <span class="ruby-operator">==</span> <span class="ruby-constant">BigEndian</span> <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div id="method-M000588" class="method-detail"> <a name="M000588"></a> <div class="method-heading"> <a href="#M000588" class="method-signature"> <span class="method-name">byte_order</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p> examines the byte order of the underlying machine </p> <p><a class="source-toggle" href="#" onclick="toggleCode('M000588-source');return false;">[Source]</a></p> <div class="method-source-code" id="M000588-source"> <pre> <span class="ruby-comment cmt"># File lib/carat/byteorder.rb, line 9</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">byte_order</span> <span class="ruby-keyword kw">if</span> [<span class="ruby-value">0x12345678</span>].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">"L"</span>) <span class="ruby-operator">==</span> <span class="ruby-value str">"\x12\x34\x56\x78"</span> <span class="ruby-constant">BigEndian</span> <span class="ruby-keyword kw">else</span> <span class="ruby-constant">LittleEndian</span> <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div id="method-M000589" class="method-detail"> <a name="M000589"></a> <div class="method-heading"> <span class="method-name">byteorder</span><span class="method-args">()</span> </div> <div class="method-description"> <p> Alias for <a href="ByteOrder.html#M000588">byte_order</a> </p> </div> </div> <div id="method-M000592" class="method-detail"> <a name="M000592"></a> <div class="method-heading"> <span class="method-name">little?</span><span class="method-args">()</span> </div> <div class="method-description"> <p> Alias for <a href="ByteOrder.html#M000590">little_endian?</a> </p> </div> </div> <div id="method-M000590" class="method-detail"> <a name="M000590"></a> <div class="method-heading"> <a href="#M000590" class="method-signature"> <span class="method-name">little_endian?</span><span class="method-args">()</span> </a> </div> <div class="method-description"> <p><a class="source-toggle" href="#" onclick="toggleCode('M000590-source');return false;">[Source]</a></p> <div class="method-source-code" id="M000590-source"> <pre> <span class="ruby-comment cmt"># File lib/carat/byteorder.rb, line 19</span> <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">little_endian?</span> <span class="ruby-identifier">byte_order</span> <span class="ruby-operator">==</span> <span class="ruby-constant">LittleEndian</span> <span class="ruby-keyword kw">end</span> </pre> </div> </div> </div> <div id="method-M000594" class="method-detail"> <a name="M000594"></a> <div class="method-heading"> <span class="method-name">network?</span><span class="method-args">()</span> </div> <div class="method-description"> <p> Alias for <a href="ByteOrder.html#M000591">big_endian?</a> </p> </div> </div> </div> </div> <div id="validator-badges"> <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> </div> </body> </html>