Module binary
This module provides implementations of the Binary/ByteArray/ByteString classes defined in the Binary/B proposal.
The JavaScript Binary class serves as common base class for ByteArray and ByteString and can't be instantiated. ByteArray implements a modifiable and resizable byte buffer, while ByteString implements an immutable byte sequence. The ByteArray and ByteString constructors can take several arguments. Have a look at the proposal for details.
When passed to a Java method that expects a byte array, instances of thes class are automatically unwrapped. Use the {@link #unwrap()} method to explicitly get the wrapped Java byte array.
Class Binary
Class ByteArray
Instance Methods
- concat()
- copy()
- decodeToString()
- every(fn, thisObj)
- filter(fn, thisObj)
- forEach(fn, thisObj)
- indexOf(sequence, [startAt])
- lastIndexOf()
- map(fn, thisObj)
- pop()
- push()
- reduce(fn, initialValue)
- reduceRight(fn, initialValue)
- reverse()
- shift()
- slice()
- some(fn, thisObj)
- sort(fn)
- split()
- toArray()
- toByteArray()
- toByteString()
- toString()
- unshift()
Instance Properties
Class ByteString
Class String
Instance Methods
- toByteArray(charset)
- toByteString(charset)
Binary ()
Abstract base class for ByteArray and ByteString
ByteArray ()
A writable byte array.
ByteArray.prototype.concat ()
ByteArray.prototype.copy ()
Copy a range of bytes from this object to another byte array.
ByteArray.prototype.decodeToString ()
ByteArray.prototype.indexOf (sequence, [startAt])
Parameters
| number|Binary | sequence | the number or binary to look for |
| number | [startAt] | optional index position |
Returns
| number | the index of the first occurrence of sequence, or -1 |
ByteArray.prototype.lastIndexOf ()
ByteArray.prototype.length
ByteArray.prototype.pop ()
ByteArray.prototype.push ()
ByteArray.prototype.reverse ()
ByteArray.prototype.shift ()
ByteArray.prototype.slice ()
ByteArray.prototype.split ()
ByteArray.prototype.toArray ()
ByteArray.prototype.toByteArray ()
ByteArray.prototype.toByteString ()
ByteArray.prototype.toString ()
ByteArray.prototype.unshift ()
ByteString ()
An immutable byte string.
