<virtual> new Binary()
Abstract base class for ByteArray and ByteString
- Source:
Methods
-
get(offset) → {ByteString}
-
Returns the byte at the given offset.
Parameters:
Name Type Description offset
Number - Source:
Returns:
- Type
- ByteString
-
indexOf(sequence, start, stop) → {Number}
-
Returns the index of the first occurrence of sequence (a Number or a ByteString or ByteArray of any length), or -1 if none was found. If start and/or stop are specified, only elements between the indexes start and stop are searched.
Parameters:
Name Type Description sequence
Number | Binary the number or binary to look for
start
Number optional index position at which to start searching
stop
Number optional index position at which to stop searching
- Source:
Returns:
the index of the first occurrence of sequence, or -1
- Type
- Number
-
lastIndexOf(sequence, start, stop) → {Number}
-
Returns the index of the last occurrence of sequence (a Number or a ByteString or ByteArray of any length) or -1 if none was found. If start and/or stop are specified, only elements between the indexes start and stop are searched.
Parameters:
Name Type Description sequence
Number | Binary the number or binary to look for
start
Number optional index position at which to start searching
stop
Number optional index position at which to stop searching
- Source:
Returns:
the index of the last occurrence of sequence, or -1
- Type
- Number
-
toArray(charset) → {array}
-
Returns an array containing the bytes as numbers.
Parameters:
Name Type Description charset
String optional the name of the string encoding
- Source:
Returns:
- Type
- array