Uint8Array.hx 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. /** <p>The <code>UInt8Array</code> type represents an array of 8-bit unsigned integers.</p>
  25. <p>Once established, you can reference elements in the array using the object's methods, or using standard array index syntax (that is, using bracket notation).</p><br><br>
  26. Documentation for this class was provided by <a href="https://developer.mozilla.org/en/JavaScript_typed_arrays/Uint8Array">MDN</a>. */
  27. @:native("Uint8Array")
  28. extern class Uint8Array extends ArrayBufferView implements ArrayAccess<Int>
  29. {
  30. /** The size, in bytes, of each array element. */
  31. static inline var BYTES_PER_ELEMENT : Int = 1;
  32. /** The number of entries in the array; for these 8-bit values, this is the same as the size of the array in bytes. <strong>Read only.</strong> */
  33. var length(default,null) : Int;
  34. /** <div class="note"><strong>Note:</strong> In these methods, <code><em>TypedArray</em></code> represents any of the <a title="en/JavaScript typed arrays/ArrayBufferView#Typed array subclasses" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/ArrayBufferView#Typed_array_subclasses">typed array object types</a>.</div>
  35. <table class="standard-table"> <tbody> <tr> <td><code>Uint8Array <a title="en/JavaScript typed arrays/Uint8Array#Int8Array()" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/Uint8Array#Int8Array%28%29">Uint8Array</a>(unsigned long length);<br> </code></td> </tr> <tr> <td><code>Uint8Array </code><code><a title="en/JavaScript typed arrays/Uint8Array#Int8Array()" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/Uint8Array#Int8Array%28%29">Uint8Array</a></code><code>(<em>TypedArray</em> array);<br> </code></td> </tr> <tr> <td><code>Uint8Array </code><code><a title="en/JavaScript typed arrays/Uint8Array#Int8Array()" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/Uint8Array#Int8Array%28%29">Uint8Array</a></code><code>(sequence&lt;type&gt; array);<br> </code></td> </tr> <tr> <td><code>Uint8Array </code><code><a title="en/JavaScript typed arrays/Uint8Array#Int8Array()" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/Uint8Array#Int8Array%28%29">Uint8Array</a></code><code>(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long length);<br> </code></td> </tr> </tbody>
  36. </table><p>Returns a new Uint8Array object.</p>
  37. <pre>Uint8Array Uint8Array(
  38. &nbsp; unsigned long length
  39. );
  40. Uint8Array Uint8Array(
  41. &nbsp; <em>TypedArray</em> array
  42. );
  43. Uint8Array Uint8Array(
  44. &nbsp; sequence&lt;type&gt; array
  45. );
  46. Uint8Array Uint8Array(
  47. &nbsp; ArrayBuffer buffer,
  48. &nbsp; optional unsigned long byteOffset,
  49. &nbsp; optional unsigned long length
  50. );
  51. </pre>
  52. <div id="section_7"><span id="Parameters"></span><h6 class="editable">Parameters</h6>
  53. <dl> <dt><code>length</code></dt> <dd>The number of elements in the byte array. If unspecified, length of the array view will match the buffer's length.</dd> <dt><code>array</code></dt> <dd>An object of any of the typed array types (such as <code>Int32Array</code>), or a sequence of objects of a particular type, to copy into a new <a title="en/JavaScript typed arrays/ArrayBuffer" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/ArrayBuffer"><code>ArrayBuffer</code></a>. Each value in the source array is converted to an 8-bit unsigned integer before being copied into the new array.</dd> <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>Uint8Array</code> object.</dd> <dt><code>byteOffset<br> </code></dt> <dd>The offset, in bytes, to the first byte in the specified buffer for the new view to reference. If not specified, the <code>Uint8Array</code>'s view of the buffer will start with the first byte.</dd>
  54. </dl>
  55. </div><div id="section_8"><span id="Return_value"></span><h6 class="editable">Return value</h6>
  56. <p>A new <code>Uint8Array</code> object representing the specified data buffer.</p>
  57. </div> */
  58. @:overload( function( length : Int ) : Void {} )
  59. @:overload( function( array : Array<Int> ) : Void {} )
  60. @:overload( function( array : Uint8Array ) : Void {} )
  61. function new( buffer : ArrayBuffer, ?byteOffset : Int, ?length : Int ) : Void;
  62. /** <p>Sets multiple values in the typed array, reading input values from a specified array.</p>
  63. <div id="section_13"><span id="Parameters_2"></span><h6 class="editable">Parameters</h6>
  64. <dl> <dt><code>array</code></dt> <dd>An array from which to copy values. All values from the source array are copied into the target array, unless the length of the source array plus the offset exceeds the length of the target array, in which case an exception is thrown. If the source array is a typed array, the two arrays may share the same underlying <code><a title="en/JavaScript typed arrays/ArrayBuffer" rel="internal" href="https://developer.mozilla.org/en/JavaScript_typed_arrays/ArrayBuffer">ArrayBuffer</a></code>; the browser will intelligently copy the source range of the buffer to the destination range.</dd> <dt>offset
  65. <span title="">Optional</span>
  66. </dt> <dd>The offset into the target array at which to begin writing values from the source <code>array</code>. If you omit this value, 0 is assumed (that is, the source <code>array</code> will overwrite values in the target array starting at index 0).</dd>
  67. </dl>
  68. </div> */
  69. @:overload( function() :Void {} )
  70. @:overload( function( array : Uint8Array, ?offset : Int ) :Void {} )
  71. function set( array : Array<Int>, ?offset : Int ) : Void;
  72. function subarray( start : Int, ?end : Int ) : Uint8Array;
  73. }