/**
 * @fileoverview Externs for uint-buffer 0.1
 * @see https://github.com/rochars/uint-buffer
 * @externs
 */

/**
 * A class to write and read two's complement ints and unsigned ints
 * to and from byte buffers.
 */
var UintBuffer = {};

/**
 * The number of bits used by one number.
 * @type {number}
 */
UintBuffer.prototype.bits = 0;

/**
 * The number of bytes used by one number.
 * @type {number}
 */
UintBuffer.prototype.bytes = 0;

/**
 * Write one unsigned integer to a byte buffer.
 * @param {!Uint8Array|!Array<number>} buffer An array of bytes.
 * @param {number} num The number.
 * @param {number=} index The index being written in the byte buffer.
 * @return {number} The next index to write on the byte buffer.
 * @throws {Error} If num is NaN.
 * @throws {Error} On overflow.
 */
UintBuffer.prototype.pack = function(buffer, num, index=0) {};

/**
 * Read one unsigned integer from a byte buffer.
 * @param {!Uint8Array|!Array<number>} buffer An array of bytes.
 * @param {number=} index The index to read.
 * @return {number} The number.
 * @throws {Error} On overflow.
 */
UintBuffer.prototype.unpack = function(buffer, index=0) {};

/**
 * Read one integer number from a byte buffer.
 * @param {!Uint8Array|!Array<number>} buffer An array of bytes.
 * @param {number} index The index to read.
 * @return {number}
 * @protected
 */
UintBuffer.prototype.unpackUnsafe = function(buffer, index) {};

/**
 * Throws error in case of overflow.
 * @param {number} num The number.
 * @throws {Error} on overflow.
 * @protected
 */
UintBuffer.prototype.overflow = function(num) {};
