Limitation:
The size of the resulting byte representation is limited by the quota api.jsArrayBufferSize that is defining the max size for a ArrayBuffer.
Construct a Bytes object from the given ArrayBuffer or view. The bytes object also acts as a
view on the underlying ArrayBuffer. If a view is given that makes only a part of the storage
array visible then this Bytes object will also make only the same part visible. The storage data is not copied.
Parameters:
arrayBufferOrView - An ArrayBuffer or view to a buffer that is the storage.
Construct a Bytes object from the given string using the given encoding.
This method always replaces malformed input and unmappable character
sequences with encoding defaults.
Parameters:
string - The string to encode into a Bytes object, must not be null.
encoding - The name of a supported encoding, or null in which case the default encoding (UTF-8) is used.
Throws:
IllegalArgumentException - If the named encoding is not supported or if the encoded byte sequence exceeds the maximum number of bytes.
Returns the value of the byte at position index as an integer. If index
is out of range an exception is thrown. The byte is interpreted as signed
and so the value returned will always be between -128 and +127.
Parameters:
index - The index of the byte.
Returns:
The byte value at the specified index.
Throws:
IndexOutOfBoundsException - If the index argument is negative or not less than the length of this byte array.
Return a new Bytes object containing the subsequence of this object's bytes specified by the index and length
parameters. The returned object is a new view onto the same data, no data is copied.
Parameters:
index - The initial index for the new view, inclusive.
length - The number of bytes visible in the new view.
Returns:
a new Bytes object representing a subsequence of this Bytes object.
Throws:
ArrayIndexOutOfBoundsException - If index < 0 or index > getLength() or index + length > getLength()
Constructs a new String by decoding this array of bytes using the
default encoding. Convenience for toString( "UTF-8" ).
Limitation:
The method is protected by the quota api.jsStringLength that prevents creation of too long strings.
Constructs a new String by decoding this array of bytes using the
specified encoding.
Limitation:
The method is protected by the quota api.jsStringLength that prevents creation of too long strings.
Parameters:
encoding - The name of a supported encoding.
Returns:
A String representing the decoded array of bytes.
Throws:
IllegalArgumentException - If the named encoding is not supported.