diff --git a/bower.json b/bower.json index 54dd0ca..24ab6aa 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "bytebuffer", - "version": "3.0.0", + "version": "3.0.1", "author": "Daniel Wirtz ", "description": "A full-featured ByteBuffer implementation using typed arrays.", "main": "ByteBuffer.js", diff --git a/dist/ByteBufferAB.js b/dist/ByteBufferAB.js index 5d3eaab..d48d982 100644 --- a/dist/ByteBufferAB.js +++ b/dist/ByteBufferAB.js @@ -118,7 +118,7 @@ * @const * @expose */ - ByteBuffer.VERSION = "3.0.0"; + ByteBuffer.VERSION = "3.0.1"; /** * Little endian constant that can be used instead of its boolean value. Evaluates to `true`. @@ -252,7 +252,7 @@ /** * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its * {@link ByteBuffer#limit} to the length of the wrapped data. - * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} buffer Anything that can be wrapped + * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.} buffer Anything that can be wrapped * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to * "utf8") * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to diff --git a/dist/ByteBufferAB.min.js b/dist/ByteBufferAB.min.js index de24666..b53d9d8 100644 --- a/dist/ByteBufferAB.min.js +++ b/dist/ByteBufferAB.min.js @@ -7,7 +7,7 @@ (function(r){function q(k){function d(a,b,c){"undefined"===typeof a&&(a=d.DEFAULT_CAPACITY);"undefined"===typeof b&&(b=d.DEFAULT_ENDIAN);"undefined"===typeof c&&(c=d.DEFAULT_NOASSERT);if(!c){a|=0;if(0>a)throw new RangeError("Illegal capacity: 0 <= "+a);if("boolean"!==typeof b)throw new TypeError("Illegal littleEndian: Not a boolean");if("boolean"!==typeof c)throw new TypeError("Illegal noAssert: Not a boolean");}this.buffer=0===a?q:new ArrayBuffer(a);this.view=0===a?null:new DataView(this.buffer); this.offset=0;this.markedOffset=-1;this.limit=a;this.littleEndian="undefined"!==typeof b?!!b:!1;this.noAssert=!!c}function s(a,b){var c=b,e,d,f,g;e=a.view.getUint8(b++);if(0!==(e&128))if(192===(e&224))d=a.view.getUint8(b++),e=(e&31)<<6|d&63;else if(224===(e&240))d=a.view.getUint8(b++),f=a.view.getUint8(b++),e=(e&15)<<12|(d&63)<<6|f&63;else if(240===(e&248))d=a.view.getUint8(b++),f=a.view.getUint8(b++),g=a.view.getUint8(b++),e=(e&7)<<18|(d&63)<<12|(f&63)<<6|g&63;else throw RangeError("Illegal code point at offset "+ b+": "+e);return{codePoint:e,length:b-c}}function r(a){if(0>a)throw RangeError("Illegal code point: "+a);if(128>a)return 1;if(2048>a)return 2;if(65536>a)return 3;if(1114112>a)return 4;throw RangeError("Illegal code point: "+a);}function t(a){for(var b,c=0,e=0;e=b&&(b=a.codePointAt(e),65535a)throw RangeError("Illegal code point: "+a);if(128>a)b.view.setUint8(c++,a&127);else if(2048>a)b.view.setUint8(c++, -a>>6&31|192),b.view.setUint8(c++,a&63|128);else if(65536>a)b.view.setUint8(c++,a>>12&15|224),b.view.setUint8(c++,a>>6&63|128),b.view.setUint8(c++,a&63|128);else if(1114112>a)b.view.setUint8(c++,a>>18&7|240),b.view.setUint8(c++,a>>12&63|128),b.view.setUint8(c++,a>>6&63|128),b.view.setUint8(c++,a&63|128);else throw RangeError("Illegal code point: "+a);return c-e}d.VERSION="3.0.0";d.LITTLE_ENDIAN=!0;d.BIG_ENDIAN=!1;d.DEFAULT_CAPACITY=16;d.DEFAULT_ENDIAN=d.BIG_ENDIAN;d.DEFAULT_NOASSERT=!1;d.Long=k||null; +a>>6&31|192),b.view.setUint8(c++,a&63|128);else if(65536>a)b.view.setUint8(c++,a>>12&15|224),b.view.setUint8(c++,a>>6&63|128),b.view.setUint8(c++,a&63|128);else if(1114112>a)b.view.setUint8(c++,a>>18&7|240),b.view.setUint8(c++,a>>12&63|128),b.view.setUint8(c++,a>>6&63|128),b.view.setUint8(c++,a&63|128);else throw RangeError("Illegal code point: "+a);return c-e}d.VERSION="3.0.1";d.LITTLE_ENDIAN=!0;d.BIG_ENDIAN=!1;d.DEFAULT_CAPACITY=16;d.DEFAULT_ENDIAN=d.BIG_ENDIAN;d.DEFAULT_NOASSERT=!1;d.Long=k||null; var q=new ArrayBuffer(0);d.allocate=function(a,b,c){return new d(a,b,c)};d.concat=function(a,b,c,e){if("boolean"===typeof b||"string"!==typeof b)e=c,c=b,b=void 0;for(var h=0,f=0,g=a.length,l;f=l||(e.set((new Uint8Array(c.buffer)).subarray(c.offset,c.limit),b.offset),b.offset+=l);b.limit=b.offset;b.offset= 0;return b};d.isByteBuffer=function(a){return a&&a instanceof d};d.type=function(){return ArrayBuffer};d.wrap=function(a,b,c,e){"string"!==typeof b&&(e=c,c=b,b=void 0);if("string"===typeof a)switch("undefined"===typeof b&&(b="utf8"),b){case "base64":return d.fromBase64(a,c);case "hex":return d.fromHex(a,c);case "binary":return d.fromBinary(a,c);case "utf8":return d.fromUTF8(a,c);case "debug":return d.fromDebug(a,c);default:throw new TypeError("Unsupported encoding: "+b);}if(null===a||"object"!==typeof a)throw new TypeError("Illegal buffer: null or non-object"); if(d.isByteBuffer(a))return b=d.prototype.clone.call(a),b.markedOffset=-1,b;if(a instanceof Uint8Array)b=new d(0,c,e),0} buffer Anything that can be wrapped * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to * "utf8") * @param {boolean=} littleEndian Whether to use little or big endian byte order. Defaults to diff --git a/docs/ByteBuffer.html b/docs/ByteBuffer.html index cfe2267..6cc018c 100644 --- a/docs/ByteBuffer.html +++ b/docs/ByteBuffer.html @@ -3772,6 +3772,9 @@
Parameters:
| string +| + +!Array.<number> diff --git a/package.json b/package.json index bf14254..0f594bf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bytebuffer", - "version": "3.0.0", + "version": "3.0.1", "author": "Daniel Wirtz ", "description": "The swiss army knife for binary data in JavaScript.", "main": "ByteBuffer.js", @@ -16,9 +16,6 @@ "long": "~1", "bufferview": "~1" }, - "optionalDependencies": { - "memcpy": "~0.4" - }, "devDependencies": { "testjs": "~1", "metascript": "~0", diff --git a/src/methods/static/wrap.js b/src/methods/static/wrap.js index 87b0c53..110de71 100644 --- a/src/methods/static/wrap.js +++ b/src/methods/static/wrap.js @@ -2,9 +2,9 @@ * Wraps a buffer or a string. Sets the allocated ByteBuffer's {@link ByteBuffer#offset} to `0` and its * {@link ByteBuffer#limit} to the length of the wrapped data. //? if (NODE) { - * @param {!ByteBuffer|!Buffer|!ArrayBuffer|!Uint8Array|string} buffer Anything that can be wrapped + * @param {!ByteBuffer|!Buffer|!ArrayBuffer|!Uint8Array|string|!Array.} buffer Anything that can be wrapped //? } else { - * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string} buffer Anything that can be wrapped + * @param {!ByteBuffer|!ArrayBuffer|!Uint8Array|string|!Array.} buffer Anything that can be wrapped //? } * @param {(string|boolean)=} encoding String encoding if `buffer` is a string ("base64", "hex", "binary", defaults to * "utf8")