public final class Uint8Array extends TypeArray
Modifier and Type | Field and Description |
---|---|
static int |
BYTES_PER_ELEMENT |
Modifier and Type | Method and Description |
---|---|
static Uint8Array |
create(ArrayBuffer buffer)
Create a new Uint8Array object using the passed
ArrayBuffer for
its storage. |
static Uint8Array |
create(ArrayBuffer buffer,
int byteOffset)
Create a new Uint8Array object using the passed
ArrayBuffer for
its storage. |
static Uint8Array |
create(ArrayBuffer buffer,
int byteOffset,
int length)
Create a new Uint8Array object using the passed
ArrayBuffer for
its storage. |
static Uint8Array |
create(int... array)
Create a new
ArrayBuffer with enough bytes to hold array.length
elements of this typed array, then creates a typed array view referring
to the full buffer. |
static Uint8Array |
create(int length)
Create a new
ArrayBuffer with enough bytes to hold length elements
of this typed array, then creates a typed array view referring to the full
buffer. |
static Uint8Array |
create(com.google.gwt.core.client.JsArrayInteger array)
Create a new
ArrayBuffer with enough bytes to hold array.length
elements of this typed array, then creates a typed array view referring
to the full buffer. |
static Uint8Array |
create(TypeArray array)
Create a new
ArrayBuffer with enough bytes to hold array.length
elements of this typed array, then creates a typed array view referring
to the full buffer. |
int |
get(int index)
Returns the element at the given numeric index.
|
void |
set(int index,
int value)
Sets the element at the given numeric index to the given value.
|
void |
set(com.google.gwt.core.client.JsArrayInteger array)
Set multiple values, reading input values from the array.
|
void |
set(com.google.gwt.core.client.JsArrayInteger array,
int offset)
/**
Set multiple values, reading input values from the array.
|
Uint8Array |
slice(int begin)
Returns a new Uint8Array view of the
ArrayBuffer store for this
Uint8Array, referencing the elements at begin, inclusive, up to end,
exclusive. |
Uint8Array |
slice(int begin,
int end)
Returns a new Uint8Array view of the
ArrayBuffer store for this
Uint8Array, referencing the elements at begin, inclusive, up to end,
exclusive. |
getLength, reverse, set, set
getBuffer, getByteLength, getByteOffset
public static final int BYTES_PER_ELEMENT
public static Uint8Array create(int length)
ArrayBuffer
with enough bytes to hold length elements
of this typed array, then creates a typed array view referring to the full
buffer.length
- public static Uint8Array create(TypeArray array)
ArrayBuffer
with enough bytes to hold array.length
elements of this typed array, then creates a typed array view referring
to the full buffer. The contents of the new view are initialized to the
contents of the given typed array or sequence, with each element converted
to the appropriate typed array type.array
- public static Uint8Array create(int... array)
ArrayBuffer
with enough bytes to hold array.length
elements of this typed array, then creates a typed array view referring
to the full buffer. The contents of the new view are initialized to the
contents of the given typed array or sequence, with each element converted
to the appropriate typed array type.array
- public static Uint8Array create(com.google.gwt.core.client.JsArrayInteger array)
ArrayBuffer
with enough bytes to hold array.length
elements of this typed array, then creates a typed array view referring
to the full buffer. The contents of the new view are initialized to the
contents of the given typed array or sequence, with each element converted
to the appropriate typed array type.array
- public static Uint8Array create(ArrayBuffer buffer)
ArrayBuffer
for
its storage. The Uint8Array spans the entire ArrayBuffer
range.buffer
- public static Uint8Array create(ArrayBuffer buffer, int byteOffset)
ArrayBuffer
for
its storage. The Uint8Array extends from the given byteOffset until the
end of the ArrayBuffer
.
The given byteOffset must be a multiple of the element size of the
specific type, otherwise an INDEX_SIZE_ERR exception is raised.
If a given byteOffset references an area beyond the end of the
ArrayBuffer
an INDEX_SIZE_ERR exception is raised.
The length of the ArrayBuffer
minus the byteOffset must be a
multiple of the element size of the specific type, or an INDEX_SIZE_ERR
exception is raised.buffer
- byteOffset
- indicates the offset in bytes from the start of the
ArrayBuffer
public static Uint8Array create(ArrayBuffer buffer, int byteOffset, int length)
ArrayBuffer
for
its storage.
The given byteOffset must be a multiple of the element size of the
specific type, otherwise an INDEX_SIZE_ERR exception is raised.
If a given byteOffset and length references an area beyond the end of the
ArrayBuffer
an INDEX_SIZE_ERR exception is raised.buffer
- byteOffset
- indicates the offset in bytes from the start of the
ArrayBuffer
length
- the count of elements from the offset that this
Uint8Array will referencepublic int get(int index)
index
- public void set(int index, int value)
index
- value
- public void set(com.google.gwt.core.client.JsArrayInteger array)
public void set(com.google.gwt.core.client.JsArrayInteger array, int offset)
array
- offset
- indicates the index in the current array where values are
written.public Uint8Array slice(int begin)
ArrayBuffer
store for this
Uint8Array, referencing the elements at begin, inclusive, up to end,
exclusive. If either begin or end is negative, it refers to an index from
the end of the array, as opposed to from the beginning.
The slice contains all elements from begin to the end of the Uint8Array.
The range specified by the begin and end values is clamped to the valid
index range for the current array. If the computed length of the new
Uint8Array would be negative, it is clamped to zero.
The returned Uint8Array will be of the same type as the array on which this
method is invoked.begin
- public Uint8Array slice(int begin, int end)
ArrayBuffer
store for this
Uint8Array, referencing the elements at begin, inclusive, up to end,
exclusive. If either begin or end is negative, it refers to an index from
the end of the array, as opposed to from the beginning.
The slice contains all elements from begin to the end of the Uint8Array.
The range specified by the begin and end values is clamped to the valid
index range for the current array. If the computed length of the new
Uint8Array would be negative, it is clamped to zero.
The returned Uint8Array will be of the same type as the array on which this
method is invoked.begin
- end
-