DataView.hx 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (C)2005-2013 Haxe Foundation
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  20. * DEALINGS IN THE SOFTWARE.
  21. */
  22. // This file is generated, do not edit!
  23. package js.html;
  24. /** <div><strong>DRAFT</strong>
  25. <div>This page is not complete.</div>
  26. </div>
  27. <p></p>
  28. <div class="note"><strong>Note:</strong> <code>DataView</code> is not yet implemented in Gecko. It is implemented in Chrome 9.</div>
  29. <p>An <code>ArrayBuffer</code> is a useful object for representing an arbitrary chunk of data. In many cases, such data will be read from disk or from the network, and will not follow the alignment restrictions that are imposed on the <a title="en/JavaScript_typed_arrays/ArrayBufferView" rel="internal" href="/api/js/html/ArrayBufferView">Typed Array Views</a> described earlier. In addition, the data will often be heterogeneous in nature and have a defined byte order.</p>
  30. <p>The <code>DataView</code> view provides a low-level interface for reading such data from and writing it to an <code><a title="en/JavaScript_typed_arrays/ArrayBuffer" rel="internal" href="/api/js/html/ArrayBuffer">ArrayBuffer</a></code>.</p><br><br>
  31. Documentation for this class was provided by <a href="https://developer.mozilla.org/en/JavaScript_typed_arrays/DataView">MDN</a>. */
  32. @:native("DataView")
  33. extern class DataView extends ArrayBufferView
  34. {
  35. /** DataView DataView(<a title="en/JavaScript_typed_arrays/ArrayBuffer" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/ArrayBuffer">ArrayBuffer</a> buffer, optional unsigned long byteOffset, optional unsigned long byteLength);<p>Returns a new <code>DataView</code> object using the passed <a title="en/JavaScript_typed_arrays/ArrayBuffer" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/ArrayBuffer">ArrayBuffer</a> for its storage.</p>
  36. <pre>DataView DataView(
  37. &nbsp; ArrayBuffer buffer,
  38. &nbsp; optional unsigned long byteOffset,
  39. &nbsp; optional unsigned long byteLength
  40. );
  41. </pre>
  42. <div id="section_6"><span id="Parameters"></span><h6 class="editable">Parameters</h6>
  43. <dl> <dt><code>buffer</code></dt> <dd>An existing <a title="en/JavaScript_typed_arrays/ArrayBuffer" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/ArrayBuffer"><code>ArrayBuffer</code></a> to use as the storage for the new <code>DataView</code> object.</dd> <dt><code>byteOffset</code>
  44. <span title="">Optional</span>
  45. </dt> <dd>The offset, in bytes, to the first byte in the specified buffer for the new view to reference. If not specified, the view of the buffer will start with the first byte.</dd> <dt><code>byteLength</code>
  46. <span title="">Optional</span>
  47. </dt> <dd>The number of elements in the byte array. If unspecified, length of the view will match the buffer's length.</dd>
  48. </dl>
  49. </div><div id="section_7"><span id="Return_value"></span><h6 class="editable">Return value</h6>
  50. <p>A new <code>DataView</code> object representing the specified data buffer.</p>
  51. </div><div id="section_8"><span id="Exceptions_thrown"></span><h6 class="editable">Exceptions thrown</h6>
  52. <dl> <dt><code>INDEX_SIZE_ERR</code></dt> <dd>The <code>byteOffset</code> and <code>byteLength</code> result in the specified view extending past the end of the buffer.</dd>
  53. </dl>
  54. </div> */
  55. function new( ?arg0 : Dynamic, ?arg1 : Dynamic, ?arg2 : Dynamic ) : Void;
  56. function getFloat32( byteOffset : Int, ?littleEndian : Bool ) : Float;
  57. function getFloat64( byteOffset : Int, ?littleEndian : Bool ) : Float;
  58. function getInt16( byteOffset : Int, ?littleEndian : Bool ) : Int;
  59. function getInt32( byteOffset : Int, ?littleEndian : Bool ) : Int;
  60. /** <p>Gets a signed 8-bit integer at the specified byte offset from the start of the view.</p>
  61. <div id="section_11"><span id="Parameters_2"></span><h6 class="editable">Parameters</h6>
  62. <dl> <dt><code>offset</code></dt> <dd>The offset, in byte, from the start of the view where to read the data.</dd>
  63. </dl>
  64. </div><div id="section_12"><span id="Exceptions_thrown_2"></span><h6 class="editable">Exceptions thrown</h6>
  65. <dl> <dt><code>INDEX_SIZE_ERR</code></dt> <dd>The <code>byteOffset</code> is set such as it would read beyond the end of the view</dd>
  66. </dl>
  67. </div> Throws DOMException. */
  68. @:overload( function() :Dynamic {} )
  69. function getInt8( byteOffset : Int ) : Int;
  70. function getUint16( byteOffset : Int, ?littleEndian : Bool ) : Int;
  71. function getUint32( byteOffset : Int, ?littleEndian : Bool ) : Int;
  72. /** <p>Gets an unsigned 8-bit integer at the specified byte offset from the start of the view.</p>
  73. <div id="section_14"><span id="Parameters_3"></span><h6 class="editable">Parameters</h6>
  74. <dl> <dt><code>offset</code></dt> <dd>The offset, in byte, from the start of the view where to read the data.</dd>
  75. </dl>
  76. <dl> <dt><code>INDEX_SIZE_ERR</code></dt> <dd>The <code>byteOffset</code> is set such as it would read beyond the end of the view</dd>
  77. </dl>
  78. </div> Throws DOMException. */
  79. @:overload( function() :Dynamic {} )
  80. function getUint8( byteOffset : Int ) : Int;
  81. function setFloat32( byteOffset : Int, value : Float, ?littleEndian : Bool ) : Void;
  82. function setFloat64( byteOffset : Int, value : Float, ?littleEndian : Bool ) : Void;
  83. function setInt16( byteOffset : Int, value : Int, ?littleEndian : Bool ) : Void;
  84. function setInt32( byteOffset : Int, value : Int, ?littleEndian : Bool ) : Void;
  85. /** Throws DOMException. */
  86. @:overload( function() :Void {} )
  87. function setInt8( byteOffset : Int, value : Int ) : Void;
  88. function setUint16( byteOffset : Int, value : Int, ?littleEndian : Bool ) : Void;
  89. function setUint32( byteOffset : Int, value : Int, ?littleEndian : Bool ) : Void;
  90. /** Throws DOMException. */
  91. @:overload( function() :Void {} )
  92. function setUint8( byteOffset : Int, value : Int ) : Void;
  93. }