src/util/ByteBuffer.js
function ByteBuffer(arg) {
    var initial_size;
    if (arg == null) {
        initial_size = 1024 * 1024;
    } else if (typeof arg === "number") {
        initial_size = arg;
    } else if (arg instanceof Uint8Array) {
        this.buffer = arg;
        this.position = 0;  // Overwrite
        return;
    } else {
        // typeof arg -> String
        throw typeof arg + " is invalid parameter type for ByteBuffer constructor";
    }
    // arg is null or number
    this.buffer = new Uint8Array(initial_size);
    this.position = 0;
}
function ByteBuffer(arg) {
    var initial_size;
    if (arg == null) {
        initial_size = 1024 * 1024;
    } else if (typeof arg === "number") {
        initial_size = arg;
    } else if (arg instanceof Uint8Array) {
        this.buffer = arg;
        this.position = 0;  // Overwrite
        return;
    } else {
        // typeof arg -> String
        throw typeof arg + " is invalid parameter type for ByteBuffer constructor";
    }
    // arg is null or number
    this.buffer = new Uint8Array(initial_size);
    this.position = 0;
}
function ByteBuffer ( arg ) { var initial_size ; if ( arg == null ) { initial_size = 1024 * 1024 ; } else if ( typeof arg === "number" ) { initial_size = arg ; } else if ( arg instanceof Uint8Array ) { this . buffer = arg ; this . position = 0 ; // Overwrite return ; } else { // typeof arg -> String throw typeof arg + " is invalid parameter type for ByteBuffer constructor" ; } // arg is null or number this . buffer = new Uint8Array ( initial_size ) ; this . position = 0 ; }
Utilities to manipulate byte sequence
@param {(number|Uint8Array)} arg Initial size of this buffer (number), or buffer to set (Uint8Array)
@constructor
Utilities to manipulate byte sequence